Fires when the user performs the default action associated with the control.
actionPerformed(
ActionEvent evt)
Applies to AgcButtonCheck, AgcButtonImage, AgcButtonRadio, AgcButtonText, AgcList, AgcJButton, AgcJCheckBox, AgcJList, AgcJRadioButton.
For a button, actionPerformed is triggered:
mouseClicked, valueChanged, AgcButtonText.simulateClick()
Cancel Button, Default Button properties
Fires after the row cursor changes.
cursorChanged(
AgoPropertyChangeEvent evt)
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.
cursorPreChange, rowDataChanged, rowDeleted, rowInserted, rowPreDelete, rowPreInsert
Fires before the row cursor changes.
cursorPreChange(
AgoPropertyChangeEvent evt)
For information about the actions that trigger a cursor change, see cursorChanged.
See formCustomEvent.
Fires when data is loaded in the form.
dataReceivedAsync(
AgoEvent evt)
invokeQuery()
.
Fires when all the data for the form has been reloaded.
dataReloaded(
AgoEvent evt)
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.
Fires when the form's size changes.
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.
Fires when the user clicks the Insert Image button on the toolbar.
void editorImageButtonClicked(
AgoEvent evt)
Applies to AgcHTMLEditControl.
editorLinkButtonClicked, editorObjectButtonClicked events; Image Dialog property
Fires when the user clicks the Insert Link button on the toolbar.
void editorLinkButtonClicked(
AgoEvent evt)
Applies to AgcHTMLEditControl.
editorImageButtonClicked, editorObjectButtonClicked events; Link Dialog property
Fires when the user clicks the Insert Raw HTML button on the toolbar.
void editorObjectButtonClicked(
AgoEvent evt)
Applies to AgcHTMLEditControl.
editorImageButtonClicked, editorLinkButtonClicked events; Raw HTML Dialog property
Fires when a control receives keyboard focus.
focusGained(
FocusEvent focusEvent)
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.
Fires when a control loses keyboard focus.
focusLost(
FocusEvent focusEvent)
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.
Invoked after the form has been added to its frame.
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.
Fired by the fireCustomEvent()
method.
void formCustomEvent(Object identifier, Object argument)
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.
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.
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
Fires after the controls on the form are loaded and initialized but before the form is added to a frame and displayed.
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.
Fires when the form is painted.
void formPaint(
Graphics g)
g
- specifies a graphics object (java.awt.graphics), allowing the form programmer to draw directly on the form.
When a form is displayed, events occur in this order: formLoaded, formActivate, formPaint.
Formerly referred to as Paint.
Fires when validation on the form indicates a failure.
void globalValidationFailed(
AgoPropertyChangeEvent evt) throws
AgoValidationException
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
throw AgoValidationException.success( );
Failure
throw AgoValidationException.failure(
"The value in the hiredate field is wrong.");
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.
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( );
globalValidationTest, validationFailed, validationTest; Show Validation Errors, Validation Rules properties
Fires when the primary dataset of the form is about to navigate to another row.
void globalValidationTest() throws
AgoValidationException
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.
or
If validation rules and property criteria succeed, SilverStream fires validationTest.
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
throw AgoValidationException.failure( );
throw AgoValidationException.failure(
"The value in the hiredate field is wrong.");
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.");
}
globalValidationFailed, validationFailed, validationTest; Show Validation Errors, Validation Rules properties
Forms and validation in the Form Basics chapter of the Programmer's Guide
Fires when the mouse cursor moves over a link.
void htmlAnchorDetected(
AgoEvent evt)
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.
In the htmlAnchorDetected event, this code gets the URL for the link.
String sURL = (String) evt.getArgument();
Fires when the user selects a link.
void htmlAnchorSelected(
AgoEvent evt)
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.
In the htmlAnchorSelected event, this code gets the URL for the link.
String sURL = (String) evt.getArgument();
Fires when the user changes the selection in the list.
itemStateChanged(
ItemEvent evt)
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.
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;
}
}
Fires when the user presses a keyboard key.
keyPressed(
KeyEvent keyEvent)
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.
keyReleased, keyTyped, preprocessKeyPressed
Fires when the user releases a keyboard key.
keyReleased(
KeyEvent keyEvent)
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
.
keyPressed, keyTyped, preprocessKeyPressed
Fires when the user types a character.
keyTyped(
KeyEvent keyEvent)
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').
keyPressed, keyReleased, preprocessKeyPressed
See doLayout.
See formLoaded.
Fires when the user selects a MenuItem.
menuItemSelected(
MenuItem menuItem,
ActionEvent actionEvent)
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.
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;
}
Fires when the user checks or unchecks a CheckboxMenuItem.
menuItemStateChanged(
MenuItem menuItem,
ItemEvent itemEvent)
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.
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
}
}
Fires when the user clicks the mouse button.
mouseClicked(
MouseEvent mouseEvent)
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()
.
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());
}
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
Fires when the user moves the mouse while holding down a mouse button.
mouseDragged(
MouseEvent mouseEvent)
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.
mouseClicked, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased
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).
mouseEntered(
MouseEvent mouseEvent)
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.
mouseClicked, mouseDragged, mouseExited, mouseMoved, mousePressed, mouseReleased
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).
mouseExited(
MouseEvent mouseEvent)
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.
mouseClicked, mouseDragged, mouseEntered, mouseMoved, mousePressed, mouseReleased
Fires each time the user moves the mouse pointer to a new position over the control.
mouseMoved(
MouseEvent mouseEvent)
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.
mouseClicked, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased
Fires when the user presses a mouse button on the control.
mousePressed(
MouseEvent mouseEvent)
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.
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseReleased
Fires when the user releases a mouse button.
mouseReleased(
MouseEvent mouseEvent)
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.
mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed
See formPaint.
Fires when the current pane changes in an AgcTabControl.
paneChanged(int oldPane, int newPane)
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.
Panes are numbered from 0, starting with the left or top tab.
Swing-based AgcJTabbedPane uses the stateChanged event.
Fires when the user presses a key, but before any processing for that key occurs.
void formKeyFilter(
KeyEvent keyEvent)
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.
keyPressed, keyReleased, keyTyped
See windowClosing.
Fires when a bound control whose data has changed loses focus.
rowDataChanged(
AgoPropertyChangeEvent evt)
rowDeleted, rowInserted, rowPreDelete, rowPreInsert
Fires after a row is deleted from the dataset.
rowDeleted(
AgoEvent evt)
The delete()
method of AgcData triggers rowPreDelete, rowDeleted, and cursorChanged events:
rowDataChanged, rowInserted, rowPreDelete, rowPreInsert
Fires after a row is inserted in the dataset.
rowInserted(
AgoEvent evt)
The insertAfter()
and insertBefore()
methods of AgcData trigger rowPreInsert, rowInserted, and cursorChanged events.
rowDataChanged, rowDeleted, rowPreDelete, rowPreInsert
Fires before a row is deleted from the dataset.
rowPreDelete(
AgoEvent evt)
The delete()
method of AgcData triggers rowPreDelete, rowDeleted, and cursorChanged events:
rowDataChanged, rowDeleted, rowInserted, rowPreInsert
Fires before a row is inserted in the dataset.
rowPreInsert(
AgoEvent evt)
The insertAfter()
and insertBefore()
methods of AgcData trigger rowPreInsert, rowInserted, and cursorChanged events.
rowDataChanged, rowDeleted, rowInserted, rowPreDelete
Fires when the current pane changes in a AgcJTabbedPane.
stateChanged(
javax.swing.event.ChangeEvent changeEvent)
AWT-based AgcTabControl uses the paneChanged event.
To get the index of the selected tab, use code like this:
int index =
((AgcJTabbedPane)changeEvent.getSource()).getSelectedIndex();
Fires each time the specified interval occurs.
timeIntervalExpired(
EventObject event)
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.
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();
Fires when the user has entered a value in the control and that value fails a validation test.
ValidationFailed(
AgoPropertyChangeEvent evt) throws
AgoValidationException
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
throw AgoValidationException.success( );
throw AgoValidationException.success("Smith");
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:
throw AgoValidationException.failure(
"The value in the hiredate field is wrong.");
throw AgoValidationException.failure(
"The name has no vowels. Please correct the spelling.",
"Smith");
SilverStream displays the message associated with the validation error after the globalValidationFailed event.
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);
globalValidationFailed, globalValidationTest, validationTest; Show Validation Errors, Validation Rules properties
Fires when a bound control loses focus, the row cursor changes, or validation is triggered by the acceptValues() method.
ValidationTest(
AgoPropertyChangeEvent evt) throws
AgoValidationException
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:
Or
If validation rules and property criteria succeed, SilverStream fires validationTest.
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:
throw AgoValidationException.correction("Smith");
Failure
throw AgoValidationException.failure( );
throw AgoValidationException.failure(
"The value in the hiredate field is wrong.");
throw AgoValidationException.failure(
"The name has no vowels. Please correct the spelling.",
"Smith");
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( );
globalValidationFailed, globalValidationTest, validationFailed events; Show Validation Errors, Validation Rules properties
Forms and validation in the Form Basics chapter of the Programmer's Guide
Fires after the value of the control changes.
valueChanged(
AgoPropertyChangeEvent evt)
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.
actionPerformed, valueChanging
Fire each time the value of the control changes while the user continues to interact with the control.
valueChanging(
AgoPropertyChangeEvent evt)
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.
Fires when a column has been resized.
viewColumnResize(
AgoEvent evt)
Applies to AgcTreeControl, AgcView, AgcViewDownloadable.
For AgcView and AgcViewDownloadable, don't use evt.getArgument()
.
For AgcTreeControl, this event does not occur.
viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewRowExpand, viewSelectionChange
Fires when the user double clicks a selection.
viewDoubleClick(
AgoEvent evt)
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.
viewColumnResize, viewHeaderRowClick, viewRowCollapse, viewRowExpand, viewSelectionChange
Fires when the user clicks on a column label in the header row.
viewHeaderRowClick(
AgoEvent evt)
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.
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.");
}
viewColumnResize, viewDoubleClick, viewRowCollapse, viewRowExpand, viewSelectionChange
Fires after a hierarchical row has been collapsed so that its children are hidden.
viewRowCollapse(
AgoEvent evt)
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.
viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowExpand, viewSelectionChange
Fires after a hierarchical row has been expanded to show its children.
viewRowExpand(
AgoEvent evt)
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.
viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewSelectionChange
Fires when the selection changes.
viewSelectionChange(
AgoEvent evt)
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.
viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewRowExpand
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.
void windowClosing(
WindowEvent event)
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.
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);