Property and Event Reference



Chapter 5   Form Events

List of events   Top of page

Here are the form events:

actionPerformed
cursorChanged
cursorPreChange
dataReceivedAsync
dataReloaded
doLayout
editorImageButtonClicked
editorLinkButtonClicked
editorObjectButtonClicked
focusGained
focusLost
formActivate
formCustomEvent
formLoaded
formPaint
globalValidationFailed
globalValidationTest

htmlAnchorDetected
htmlAnchorSelected
itemStateChanged
keyPressed
keyReleased
keyTyped
menuItemSelected
menuItemStateChanged
mouseClicked
mouseDragged
mouseEntered
mouseExited
mouseMoved
mousePressed
mouseReleased
paneChanged
preprocessKeyPressed

rowDataChanged
rowDeleted
rowInserted
rowPreDelete
rowPreInsert
stateChanged
timeIntervalExpired
validationFailed
validationTest
valueChanged
valueChanging
viewColumnResize
viewDoubleClick
viewHeaderRowClick
viewRowCollapse
viewRowExpand
viewSelectionChange
windowClosing

actionPerformed   Top of page

Fires when the user performs the default action associated with the control.

Declaration

actionPerformed(ActionEvent evt)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcList, AgcJButton, AgcJCheckBox, AgcJList, AgcJRadioButton.

For a button, actionPerformed is triggered:

See also

mouseClicked, valueChanged, AgcButtonText.simulateClick()

Cancel Button, Default Button properties

cursorChanged   Top of page

Fires after the row cursor changes.

Declaration

cursorChanged(AgoPropertyChangeEvent evt)

Usage

Applies to AgcData.

The row cursor changes when methods such as gotoNext(), gotoFirst(), gotoChild(), and gotoParent() are called. Your code may explicitly call these methods, or SilverStream may call them internally, for example, when the application downloads more rows.

cursorChanged and cursorPreChange are relatively low-level events related to navigation of the dataset. To react to changes in the data, use a data-related event such as rowDataChanged instead.

See also

cursorPreChange, rowDataChanged, rowDeleted, rowInserted, rowPreDelete, rowPreInsert

cursorPreChange   Top of page

Fires before the row cursor changes.

Declaration

cursorPreChange(AgoPropertyChangeEvent evt)

Usage

Applies to AgcData.

For information about the actions that trigger a cursor change, see cursorChanged.

See also

cursorChanged

CustomEvent   Top of page

See formCustomEvent.

dataReceivedAsync   Top of page

Fires when data is loaded in the form.

Declaration

dataReceivedAsync(AgoEvent evt)

Usage

Applies to AgcData.

dataReceivedAsync occurs:

See also

dataReloaded

dataReloaded   Top of page

Fires when all the data for the form has been reloaded.

Declaration

dataReloaded(AgoEvent evt)

Usage

Applies to AgcData.

Calling refreshRows() causes data to be reloaded. You might call refreshRows() when an AgoDataConcurrencyException occurs. This exception indicates that data in the database is out of sync with SilverStream's cached data. This can occur when two different users are working with and updating the same data. In addition, SilverStream can automatically reload data when it becomes aware that data is out of sync.

See also

dataReceivedAsync

doLayout   Top of page

Fires when the form's size changes.

Declaration

void doLayout()

Usage

Applies to AgfForm.

A form's size can change when it is displayed in a resizable container and the user resizes the container. Such containers include:

Formerly referred to as Layout.

See also

formPaint

editorImageButtonClicked   Top of page

Fires when the user clicks the Insert Image button on the toolbar.

Declaration

void editorImageButtonClicked(AgoEvent evt)

Usage

Applies to AgcHTMLEditControl.

See also

editorLinkButtonClicked, editorObjectButtonClicked events; Image Dialog property

editorLinkButtonClicked   Top of page

Fires when the user clicks the Insert Link button on the toolbar.

Declaration

void editorLinkButtonClicked(AgoEvent evt)

Usage

Applies to AgcHTMLEditControl.

See also

editorImageButtonClicked, editorObjectButtonClicked events; Link Dialog property

editorObjectButtonClicked   Top of page

Fires when the user clicks the Insert Raw HTML button on the toolbar.

Declaration

void editorObjectButtonClicked(AgoEvent evt)

Usage

Applies to AgcHTMLEditControl.

See also

editorImageButtonClicked, editorLinkButtonClicked events; Raw HTML Dialog property

focusGained   Top of page

Fires when a control receives keyboard focus.

Declaration

focusGained(FocusEvent focusEvent)

Parameters

focusEvent

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcIntegerSpinnerField, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTable, AgcJTextArea, AgcJTextField.

See also

focusLost

focusLost   Top of page

Fires when a control loses keyboard focus.

Declaration

focusLost(FocusEvent focusEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcIntegerSpinnerField, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTable, AgcJTextArea, AgcJTextField.

See also

focusGained

formActivate   Top of page

Invoked after the form has been added to its frame.

Declaration

void formActivate()

Usage

Applies to AgfForm.

When a form is displayed, events occur in this order: formLoaded, formActivate, formPaint.

Because the form is now associated with a frame, you can add menus and other controls in the formActivate event.

Because of asynchronous event processing in the Java event queue, the form or frame may become visible before processing initiated by formActivate is finished.

See also

formLoaded, formPaint

formCustomEvent   Top of page

Fired by the fireCustomEvent() method.

Declaration

void formCustomEvent(Object identifier, Object argument)

Parameters

identifier - An agreed-upon value that identifies the event and/or form that fired it. It is up to your application to keep track of the identifiers you use when firing custom events. For example, in the fireCustomEvent() method, you might use the string "UPDATE_NOW" as an identifier. In another instance, you might call fireCustomEvent() with the identifier "DELETE". In the formCustomEvent code, you find out what identifier triggered the event and respond appropriately.

argument - Data specified in fireCustomEvent() that you want to make available to the event code.

Usage

Applies to AgfForm.

formCustomEvent is an specialized technique for communicating between a modeless dialog and its parent form. It requires the use of agreed-upon identifiers to distinguish between individual events. However, it does not require that the forms be in a single JAR file.

Calling methods directly on another form or defining those methods in an interface and implementing the interface is a simpler, more standard way of handling inter-form communication.

For more information, see the section on communicating between parent and child forms in the Programming Forms chapter of the Programmer's Guide.

Formerly referred to as CustomEvent.

Example

Suppose you have a modeless dialog with a button that causes the parent form to update its display. The code for the button's actionPerformed event is:

  fireCustomEvent(getParentForm(), new Integer(1), null) 

Then on the parent, code for formCustomEvent checks the identifier, and if it is an Integer equal to 1, it updates the display.

  if (identifier == 1) 
{
   // code to handle event #1, updating the display
}

if (identifier == 2)
{
   // code to handle event #2

}

formLoaded   Top of page

Fires after the controls on the form are loaded and initialized but before the form is added to a frame and displayed.

Declaration

void formLoaded()

Usage

Applies to AgfForm.

When a form is displayed, events occur in this order: formLoaded, formActivate, formPaint. The formLoaded events for subforms occur before the formLoaded event for their parent form.

In the formLoaded event, you can manipulate the data of the form, subforms, or data-loaded list controls. You can access form parameters and the current user/group information.

Because the form has not been added to a frame when formLoaded has fired, you cannot add controls and menus in this event; add these in the formActivate event.

Because the formLoaded event occurs after the controls on the form are initialized, the form can receive events from initialized controls, such as those fired by subforms or data-loaded lists. If the code for these other events depends on initialization performed in the formLoaded event, they must be coded carefully. You might use a variable to indicate whether the form is still in its initialization phase, using a declaration like this:

  private boolean initializing = true;  

When initialization is done, at the end of the formLoaded event, you can set this flag to false. Code in other events can test for the initialized state.

Formerly referred to as Loaded.

See also

formActivate, formPaint

formPaint   Top of page

Fires when the form is painted.

Declaration

void formPaint(Graphics g)

Parameters

g - specifies a graphics object (java.awt.graphics), allowing the form programmer to draw directly on the form.

Usage

Applies to AgfForm.

When a form is displayed, events occur in this order: formLoaded, formActivate, formPaint.

Formerly referred to as Paint.

See also

formActivate, formLoaded

globalValidationFailed   Top of page

Fires when validation on the form indicates a failure.

Declaration

void globalValidationFailed(AgoPropertyChangeEvent evt) throws AgoValidationException

Usage

Applies to AgfForm.

The globalValidationFailed event fires when:

Because globalValidationFailed fires after validationFailed, you can centralize error handling in globalValidationFailed, if you want.

To throw an AgoValidationException, use one of its static methods to create the exception object with the appropriate disposition and message. In globalValidationFailed, these forms are most useful.

Success

You can:

Failure

You can:

If you don't throw an AgoValidationException in globalValidationFailed, the implicit disposition is failure. When the validation process ends with a failure disposition and the Show Validation Errors property is enabled for the form, SilverStream displays the message associated with the error.

Example

This code for globalValidationFailed changes the error message associated with the validation failure:

  if (hiredate < enddate) { 
   throw AgoValidationException.failure(
      "The hiring date must be before the termination date.");
}

This code for globalValidationFailed terminates the validation process, so that no error message is displayed.

  throw AgoValidationException.success( ); 

See also

globalValidationTest, validationFailed, validationTest; Show Validation Errors, Validation Rules properties

globalValidationTest   Top of page

Fires when the primary dataset of the form is about to navigate to another row.

Declaration

void globalValidationTest() throws AgoValidationException

Usage

Applies to AgfForm.

In globalValidationTest, you have a final opportunity to validate control data before allowing the user to leave the current row. You are not limited to testing data in a single control; you can compare data in several controls.

If the data fails your application's criteria, your code can throw an AgoValidationException to trigger the globalValidationFailed event. This prevents navigation to another row.

When navigating to another row, individual controls are validated before globalValidationTest fires. This is the sequence of events.

First, for each control:

  1. SilverStream tests the value in the control against the validation rules and maximum and minimum values specified for properties.

  2. If the value fails, SilverStream fires validationFailed.

    or

    If validation rules and property criteria succeed, SilverStream fires validationTest.

  3. In the validationTest event, if you throw an AgoValidationException with a disposition of failure, SilverStream fires validationFailed.

  4. In the validationFailed event, if you don't throw an AgoValidationException with a disposition of success, SilverStream fires globalValidationFailed.

Then for the form:

  1. If all the controls pass validation (step 3 above), SilverStream fires globalValidationTest.

  2. In the globalValidationTest event, if you throw an AgoValidationException with a disposition of failure, SilverStream fires globalValidationFailed.

  3. In the globalValidationFailed event, if you don't throw an AgoValidationException with a disposition of success and the Show Validation Errors property is enabled for the form, SilverStream displays the most recently specified validation error message.

You can also trigger the validation process by calling acceptValues(), a method of PVBaseContainer.

To throw an AgoValidationException, use one of its static methods to create the exception object with the appropriate disposition and message. In globalValidationTest, these forms are most useful.

Failure

You can:

Example

This code for globalValidationTest triggers globalValidationFailed if the termination date is less than the hire date.

  if (hiredate < enddate) { 
   throw AgoValidationException.failure( );
}

This code for globalValidationTest changes the error message associated with the validation failure and triggers globalValidationFailed:

  if (hiredate < enddate) { 
   throw AgoValidationException.failure(
      "The hiring date must be before the termination date.");
}

See also

globalValidationFailed, validationFailed, validationTest; Show Validation Errors, Validation Rules properties

Forms and validation in the Form Basics chapter of the Programmer's Guide

htmlAnchorDetected   Top of page

Fires when the mouse cursor moves over a link.

Declaration

void htmlAnchorDetected(AgoEvent evt)

Usage

Applies to AgcHTMLEditControl.

The HTML editor must be in read-only mode.

The argument for the AgoEvent object is a String that is the URL for the link under the cursor.

Example

In the htmlAnchorDetected event, this code gets the URL for the link.

  String sURL = (String) evt.getArgument(); 

See also

htmlAnchorSelected

htmlAnchorSelected   Top of page

Fires when the user selects a link.

Declaration

void htmlAnchorSelected(AgoEvent evt)

Usage

Applies to AgcHTMLEditControl.

The HTML editor must be in read-only mode.

The argument for the AgoEvent object is a String that is the URL for the link under the cursor.

Example

In the htmlAnchorSelected event, this code gets the URL for the link.

  String sURL = (String) evt.getArgument(); 

See also

htmlAnchorDetected

itemStateChanged   Top of page

Fires when the user changes the selection in the list.

Declaration

itemStateChanged(ItemEvent evt)

Usage

Applies to AgcChoice, AgcList, AgcJList.

The ItemEvent object has fields that provide the index of the item and whether it became selected or deselected. To get this information, call evt.getItem() and evt.getStateChange().

When the list is in single-select mode, the clicked item becomes selected and some other item becomes deselected. In multiple mode, the clicked item can become selected or deselected, without affecting other list items. The itemStateChanged event occurs for the item that the user clicked. It doesn't fire for other items whose state changes too, such as when the list is in single-select mode and a formerly selected item becomes deselected.

Example

For AgcList, this code get the index and display text of the item.

  int iItemClicked =  
   ((Integer)evt.getItem()).intValue();

String sItemText =
   ((AgcList)evt.getSource()).getItem( iItemClicked );

This code finds out whether the clicked item was selected or deselected.

  switch (evt.getStateChange()) { 
   case ItemEvent.SELECTED:
   {
      // processing for selected
      break;
   }
   case ItemEvent.DESELECTED:
   {
      // processing for deselected
      break;
   }
}

keyPressed   Top of page

Fires when the user presses a keyboard key.

Declaration

keyPressed(KeyEvent keyEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcIntegerSpinnerField, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTable, AgcJTextArea, AgcJTextField.

Call KeyEvent.getKeyCode() to determine which key was pressed. This will return a constant defined in KeyEvent, such as KeyEvent.VK_SHIFT or KeyEvent.VK_A.

keyPressed occurs for each key that is pressed, so when the user presses Shift and A to type "A", keyPressed fires twice. To capture the typed result, instead of individual key presses, use the higher-level keyTyped event.

See also

keyReleased, keyTyped, preprocessKeyPressed

keyReleased   Top of page

Fires when the user releases a keyboard key.

Declaration

keyReleased(KeyEvent keyEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcIntegerSpinnerField, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTable, AgcJTextArea, AgcJTextField.

Call keyEvent.getKeyCode() to determine which key was released. This will return a constant defined in KeyEvent, such as KeyEvent.VK_SHIFT or KeyEvent.VK_A.

See also

keyPressed, keyTyped, preprocessKeyPressed

keyTyped   Top of page

Fires when the user types a character.

Declaration

keyTyped(KeyEvent keyEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcIntegerSpinnerField, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTable, AgcJTextArea, AgcJTextField.

Call KeyEvent.getKeyChar() to determine which character was typed.

Note that it may take several keyPressed events to generate one keyTyped event. For example, pressing the Shift key and the A key results in two keyPressed events (KeyEvent.VK_SHIFT and KeyEvent.VK_A), followed by one keyTyped event ('A').

See also

keyPressed, keyReleased, preprocessKeyPressed

Layout   Top of page

See doLayout.

Loaded   Top of page

See formLoaded.

menuItemSelected   Top of page

Fires when the user selects a MenuItem.

Declaration

menuItemSelected(MenuItem menuItem, ActionEvent actionEvent)

Usage

Applies to AgfForm.

In the event, call actionEvent.getActionCommand() to find out which MenuItem the user selected. By default, the action command is the text of the menu item. When you build the menu, you can provide a different command with the setActionCommand() method of the MenuItem object.

In Application Techniques, there are several menu examples, including a Menu Builder that will generate template code for menus you design.

Example

This code finds out what menu item was selected in order to take appropriate action.

  if (actionEvent.getActionCommand().equals ("Open")) { 
   // Code to open file
   closeMenuItem.setEnabled(true);
    return;
}

if (actionEvent.getActionCommand().equals ("Close")) {
   // Code to close file
   return;
}

if (actionEvent.getActionCommand().equals ("Save")) {
   // Code to save file
   return;
}

if (actionEvent.getActionCommand().equals ("About")) {
   // Show About box
   agDialog.showFormDialog("frmAboutBox");
   return;
}

See also

menuItemStateChanged

menuItemStateChanged   Top of page

Fires when the user checks or unchecks a CheckboxMenuItem.

Declaration

menuItemStateChanged(MenuItem menuItem, ItemEvent itemEvent)

Usage

Applies to AgfForm.

In the event, call menuItem.getActionCommand() to find out which CheckboxMenuItem triggered the event. By default, the action command is the text of the menu item. When you build the menu, you can provide a different command with the setActionCommand() method of the MenuItem object.

To find out whether the item was selected or deselected, call getStateChange() for the ItemEvent object.

Example

For a menu item named Bold, this code determines whether it was checked and processes text accordingly.

  if (menuItem.getActionCommand().equals("Bold") )  
{
   if (itemEvent.getStateChange() == itemEvent.SELECTED)
   {
      // code to make selected text bold
   }
   else
   {
      // code to remove bold from selected text
   }
}

See also

menuItemSelected

mouseClicked   Top of page

Fires when the user clicks the mouse button.

Declaration

mouseClicked(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

The mouse events are low-level events that can occur before or after related higher-level events, such as actionPerformed for buttons or itemStateChanged for lists.

A common use of the mouseClicked or mouseReleased event is to display a popup menu. To find out if the button the user clicked is the system's popup menu trigger, call mouseEvent.isPopupTrigger().

Example

This code for the mouseClicked event checks whether the button being pressed is the designated popup trigger on the user's system. If so, the code displays a menu called popup at the coordinates of the click.

  if (mouseEvent.isPopupTrigger()) { 
   popup.show(this, mouseEvent.getX(), mouseEvent.getY());
}

See also

mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased

mouseDragged   Top of page

Fires when the user moves the mouse while holding down a mouse button.

Declaration

mouseDragged(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

The control that received the mousePressed event receives the mouseDragged events regardless of the cursor's current location.

See also

mouseClicked, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased

mouseEntered   Top of page

Fires when the user places the mouse over a control (when the mouse moves from a position that is not over the control, to a position that is over the control).

Declaration

mouseEntered(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

See also

mouseClicked, mouseDragged, mouseExited, mouseMoved, mousePressed, mouseReleased

mouseExited   Top of page

Fires when the user places the mouse elsewhere on the form (when the mouse moves from a position that is over the control, to a position that is not over the control).

Declaration

mouseExited(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

See also

mouseClicked, mouseDragged, mouseEntered, mouseMoved, mousePressed, mouseReleased

mouseMoved   Top of page

Fires each time the user moves the mouse pointer to a new position over the control.

Declaration

mouseMoved(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

The mouseMoved event fires on the control under the cursor.

See also

mouseClicked, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased

mousePressed   Top of page

Fires when the user presses a mouse button on the control.

Declaration

mousePressed(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

See also

mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased

mouseReleased   Top of page

Fires when the user releases a mouse button.

Declaration

mouseReleased(MouseEvent mouseEvent)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcChoice, AgcComboBox, AgcHTMLEditControl, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcRectangle, AgcTabControl, AgcTextArea, AgcTextField, AgcTreeControl, AgcView, AgcViewDownloadable, AgfForm, AgcJButton, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTabbedPane, AgcJTable, AgcJTextArea, AgcJTextField.

The control that received the mousePressed event receives the mouseReleased event regardless of the cursor's current location.

See also

mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed

Paint   Top of page

See formPaint.

paneChanged   Top of page

Fires when the current pane changes in an AgcTabControl.

Declaration

paneChanged(int oldPane, int newPane)

Parameters

oldPane - An integer identifying the pane that was the current pane before the user changed panes.

newPane - An integer identifying the pane has just become the current pane.

Usage

Applies to AgcTabControl.

Panes are numbered from 0, starting with the left or top tab.

Swing-based AgcJTabbedPane uses the stateChanged event.

See also

stateChanged

preprocessKeyPressed   Top of page

Fires when the user presses a key, but before any processing for that key occurs.

Declaration

void formKeyFilter(KeyEvent keyEvent)

Usage

Applies to AgfForm.

Use the form-level preprocessKeyPressed event to capture keystrokes before they are passed to the control that has focus.

The preprocessKeyPressed event fires only when the control with focus does not accept typed input. For example, preprocessKeyPressed occurs when focus is on a button, check box, radio button, or list control, but not for text fields or combo boxes. It does not fire if the form itself has focus.

When the user presses a key, preprocessKeyPressed fires for the form, then the key events fire for the control. For example, you could use this event to process a function key, such as popping up a menu for the F4 key.

See also

keyPressed, keyReleased, keyTyped

QueryClose   Top of page

See windowClosing.

rowDataChanged   Top of page

Fires when a bound control whose data has changed loses focus.

Declaration

rowDataChanged(AgoPropertyChangeEvent evt)

Usage

Applies to AgcData.

See also

rowDeleted, rowInserted, rowPreDelete, rowPreInsert

rowDeleted   Top of page

Fires after a row is deleted from the dataset.

Declaration

rowDeleted(AgoEvent evt)

Usage

Applies to AgcData.

The delete() method of AgcData triggers rowPreDelete, rowDeleted, and cursorChanged events:

See also

rowDataChanged, rowInserted, rowPreDelete, rowPreInsert

rowInserted   Top of page

Fires after a row is inserted in the dataset.

Declaration

rowInserted(AgoEvent evt)

Usage

Applies to AgcData.

The insertAfter() and insertBefore() methods of AgcData trigger rowPreInsert, rowInserted, and cursorChanged events.

See also

rowDataChanged, rowDeleted, rowPreDelete, rowPreInsert

rowPreDelete   Top of page

Fires before a row is deleted from the dataset.

Declaration

rowPreDelete(AgoEvent evt)

Usage

Applies to AgcData.

The delete() method of AgcData triggers rowPreDelete, rowDeleted, and cursorChanged events:

See also

rowDataChanged, rowDeleted, rowInserted, rowPreInsert

rowPreInsert   Top of page

Fires before a row is inserted in the dataset.

Declaration

rowPreInsert(AgoEvent evt)

Usage

Applies to AgcData.

The insertAfter() and insertBefore() methods of AgcData trigger rowPreInsert, rowInserted, and cursorChanged events.

See also

rowDataChanged, rowDeleted, rowInserted, rowPreDelete

stateChanged   Top of page

Fires when the current pane changes in a AgcJTabbedPane.

Declaration

stateChanged(javax.swing.event.ChangeEvent changeEvent)

Usage

Applies to AgcJTabbedPane.

AWT-based AgcTabControl uses the paneChanged event.

Example

To get the index of the selected tab, use code like this:

  int index =  
   ((AgcJTabbedPane)changeEvent.getSource()).getSelectedIndex();

See also

paneChanged

timeIntervalExpired   Top of page

Fires each time the specified interval occurs.

Declaration

timeIntervalExpired(EventObject event)

Usage

Applies to AgcTimer.

If the Interval is set to 1, then the timeIntervalExpired event fires every second; if the interval is 5, it fires every 5 seconds and so on.

After the event fires the timer resets until you explicitly stop it. To stop the timer, call the stopTimer() method.

Example

This code in the timeIntervalExpired event stops the timer, increases the interval, and starts the timer again.

  timer = (AgcTimer)event.getSource(); 
timer.stopTimer();
timer.setInterval(timer.getInterval() * 1.1);
timer.startTimer();

validationFailed   Top of page

Fires when the user has entered a value in the control and that value fails a validation test.

Declaration

ValidationFailed(AgoPropertyChangeEvent evt) throws AgoValidationException

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcChoice, AgcComboBox, AgcFileAttachment, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcViewDownloadable, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTextArea, AgcJTextField.

SilverStream tests the value in a bound control when that control loses focus or when the form is about to navigate to a new row (a sequence of events described in globalValidationTest).

SilverStream fires the validationFailed event when:

The globalValidationFailed event occurs after the validationFailed event unless you throw an AgoValidationException with a disposition of success.

In validationFailed, you can correct the value, display a message to the user, or defer processing to the globalValidationFailed event. If you change the value in code, the change does not trigger validation. However, validation can occur later, when the user navigates to another row.

To throw an AgoValidationException, use one of its static methods to create the exception object with the appropriate disposition and message. In validationFailed, these forms are most useful.

Success

You can:

Failure

You don't need to throw an exception with a disposition of failure, since this disposition is assumed. To modify the failure information, you can:

SilverStream displays the message associated with the validation error after the globalValidationFailed event.

Example

This validation rule for a date input field causes validationFailed to fire if the user enters a future date.

  _newValue < today() 

This code for the validationFailed event prevents globalValidationFailed from firing.

  throw AgoValidationException.success( ); 

For a bound control, this code for the validationFailed event supplies a corrected value and prevents globalValidationFailed from firing.

  throw AgoValidationException.correction("Smith" ); 

For a control that is not bound, this code for the validationFailed event sets the control's value to "Error" and indicates failure.

  evt.getSource().setText("Error"); 
throw AgoValidationException.failure(
   "Please specify a correct value);

See also

globalValidationFailed, globalValidationTest, validationTest; Show Validation Errors, Validation Rules properties

validationTest   Top of page

Fires when a bound control loses focus, the row cursor changes, or validation is triggered by the acceptValues() method.

Declaration

ValidationTest(AgoPropertyChangeEvent evt) throws AgoValidationException

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcChoice, AgcComboBox, AgcFileAttachment, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcViewDownloadable, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTextArea, AgcJTextField.

The validation process can occur for a single control when that control loses focus. Also as part of the global validation process for the form, each control is validated individually first.

For a control, the validation process involves these actions:

  1. SilverStream tests the validation rules and maximum and minimum values. If a value fails, SilverStream fires validationFailed. The validation error message you specified in the Property Inspector is associated with the error.

    Or

    If validation rules and property criteria succeed, SilverStream fires validationTest.

  2. In the validationTest event, if you throw an AgoValidationException with a disposition of failure, SilverStream fires validationFailed.

  3. In the validationFailed event, if you don't throw an AgoValidationException with a disposition of success, SilverStream fires globalValidationFailed.

  4. In the globalValidationFailed event, if you don't throw an AgoValidationException with a disposition of success and Show Validation Errors is enabled for the form, SilverStream displays the validation error message associated with the error.

To throw an AgoValidationException, use one of its static methods to create the exception object with the appropriate disposition. In validationTest, these forms are most useful.

Success

You don't need to throw an exception with a disposition of success, since this condition is assumed. However, you can:

Failure

You can:

Example

In the validationTest event for a text field, this code tests the value the user entered. If it is empty or set to the default value of "Your value here", it throws an exception with a failure disposition that triggers the validationFailed event.

  if (evt.getNewValue() == null ||  
      evt.getNewValue().equals("Your value here")) {
   throw AgoValidationException.failure( );

See also

globalValidationFailed, globalValidationTest, validationFailed events; Show Validation Errors, Validation Rules properties

Forms and validation in the Form Basics chapter of the Programmer's Guide

valueChanged   Top of page

Fires after the value of the control changes.

Declaration

valueChanged(AgoPropertyChangeEvent evt)

Usage

Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcChoice, AgcComboBox, AgcFileAttachment, AgcImage, AgcIntegerSpinnerField, AgcLabel, AgcList, AgcTextArea, AgcTextField, AgcTreeControl, AgcViewDownloadable, AgcJCheckBox, AgcJComboBox, AgcJIntegerSpinnerField, AgcJLabel, AgcJList, AgcJRadioButton, AgcJSlider, AgcJTextArea, AgcJTextField.

The valueChanged event fires whether the user, application code, or SilverStream made the change.

For button and some list controls, use the actionPerformed event, instead of valueChanged, to respond to the user's action.

For a group of radio button controls, when the user clicks one radio button, an actionPerformed event occurs for the clicked button and valueChanged occurs for all the buttons.

See also

actionPerformed, valueChanging

valueChanging   Top of page

Fire each time the value of the control changes while the user continues to interact with the control.

Declaration

valueChanging(AgoPropertyChangeEvent evt)

Usage

Applies to AgcComboBox, AgcIntegerSpinnerField, AgcJComboBox, AgcJIntegerSpinnerField, AgcJSlider.

valueChanging occurs while the user is:

valueChanging fires repeatedly as the value changes.

When the user finishes changing the value by releasing the arrow button, slider tab, or dropdown list, the control fires a valueChanged event.

See also

valueChanged

viewColumnResize   Top of page

Fires when a column has been resized.

Declaration

viewColumnResize(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcView and AgcViewDownloadable, don't use evt.getArgument().

For AgcTreeControl, this event does not occur.

See also

viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewRowExpand, viewSelectionChange

viewDoubleClick   Top of page

Fires when the user double clicks a selection.

Declaration

viewDoubleClick(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcTreeControl, the argument for the AgoEvent object is an object of type com.sssw.rt.form.AgoTreeControlNode.

For AgcView and AgcViewDownloadable, don't use evt.getArgument(). To get information about the selection, query the view itself.

See also

viewColumnResize, viewHeaderRowClick, viewRowCollapse, viewRowExpand, viewSelectionChange

viewHeaderRowClick   Top of page

Fires when the user clicks on a column label in the header row.

Declaration

viewHeaderRowClick(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcView and AgcViewDownloadable, the argument for the AgoEvent object is an object of type com.sssw.rt.tview.AgoHeaderRowClick.

For AgcTreeControl, this event does not occur.

Example

This code in the viewHeaderRowClick event gets the index of the column that the user clicked and whether the Shift key was pressed. It sorts the view by the column in ascending order if the Shift key was not pressed and descending order if it was pressed.

  AgcView vw = (AgcView)evt.getSource(); 
AgoHeaderRowClick head = (AgoHeaderRowClick)evt.getArgument();
int col = head.getColumnIndex();
boolean descending = head.shiftDown();
try {
   vw.sort(col, descending);
} catch (Exception e) {
   agDialog.showMessage("Error", "Error sorting view.");
}

See also

viewColumnResize, viewDoubleClick, viewRowCollapse, viewRowExpand, viewSelectionChange

viewRowCollapse   Top of page

Fires after a hierarchical row has been collapsed so that its children are hidden.

Declaration

viewRowCollapse(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcTreeControl, the argument for the AgoEvent object is an object of type com.sssw.rt.form.AgoTreeControlNode.

For AgcView and AgcViewDownloadable, don't use evt.getArgument(). To get information about the selection, query the view itself.

See also

viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowExpand, viewSelectionChange

viewRowExpand   Top of page

Fires after a hierarchical row has been expanded to show its children.

Declaration

viewRowExpand(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcTreeControl, the argument for the AgoEvent object is an object of type com.sssw.rt.form.AgoTreeControlNode.

For AgcView and AgcViewDownloadable, don't use evt.getArgument(). To get information about the selection, query the view itself.

See also

viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewSelectionChange

viewSelectionChange   Top of page

Fires when the selection changes.

Declaration

viewSelectionChange(AgoEvent evt)

Usage

Applies to AgcTreeControl, AgcView, AgcViewDownloadable.

For AgcTreeControl, the argument for the AgoEvent object is an object of type com.sssw.rt.form.AgoTreeControlNode.

For AgcView and AgcViewDownloadable, don't use evt.getArgument(). To get information about the selection, query the view itself.

See also

viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewRowExpand

windowClosing   Top of page

Fires when the user clicks the system Close box in the window's title bar or selects Close from the System menu for the window.

Declaration

void windowClosing(WindowEvent event)

Usage

Applies to AgfForm.

When a form is displayed as a dialog, you can use this event to prevent the user from closing the dialog via the close mechanisms provided by the operating system's user interface, such as the Close box or the system menu's Close menu item.

If there is any code in this event, even a comment, it will prevent the window from closing. It is up to you to write code, either in this event or elsewhere (for example, on a button) that will perform any data-processing you wish to happen before the window closes. Then, to allow the dialog to close, call the closeDialog() method in the event. If there is no code for the event, the form closes as usual.

A typical use of the windowClosing event is to ask the user if data needs to be saved before allowing the window to close.

This event only occurs on the main form in the window whose close box the user clicked. It is not called on any subforms, or any forms that have been popped up in frames or modeless dialogs. It is up to you to notify these other forms if required by your application.

The windowClosing event is not fired when your code closes the window. For example, if your dialog has an OK button whose actionPerformed event calls closeDialog(), the dialog simply closes. If data needs to be saved, the actionPerformed event must execute code to do the saving.

To test code for this event, run the form from the Main Designer. When you use Test Mode in the Form Designer, SilverStream controls the window events and they do not behave as they would in an independent window.

Formerly referred to as QueryClose.

Example

This code for the windowClosing event displays a message box asking if the user wants to save changes before the dialog closes.

  if (agDialog.showMessageYesNo("Saving Data", 
   "Save changes before closing?"))
{
   // code to save data
}
closeDialog(Boolean.TRUE);






Copyright © 2000, SilverStream Software, Inc. All rights reserved.