MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / actionCommand

Method actionCommand

CodenameOne/src/com/codename1/ui/Dialog.java:1878–1898  ·  view source on GitHub ↗
(Command cmd)

Source from the content-addressed store, hash-verified

1876 ///
1877 /// - `cmd`: the action command
1878 @Override
1879 protected void actionCommand(Command cmd) {
1880 // this is important... In a case of nested dialogs based on commands/events a command might be
1881 // blocked by a different dialog, so when that dialog is disposed (as a result of a command) going
1882 // back to this dialog will block that command from proceeding and it can be fired again later
1883 // E.g.:
1884 // Dialog A has a command which triggers dialog B on top.
1885 // User presses Cancel in dialog B
1886 // Dialog A is shown as a result of dialog B dispose method
1887 // Cancel command event firing is blocked since the dialog B dispose method is now blocking on dialog A show()...
1888 // When dialog A is disposed using the OK command the OK command is sent correctly and causes dispose
1889 // EDT is released which also releases the Cancel for dialog B to keep processing...
1890 // Cancel for dialog B proceeds in the event chain reaching this method....
1891 // lastCommandPressed can be overrwritten if this check isn't made!!!
1892 if (!autoDispose || lastCommandPressed == null) {
1893 lastCommandPressed = cmd;
1894 }
1895 if (menu || (autoDispose && cmd.isDisposesDialog())) {
1896 dispose();
1897 }
1898 }
1899
1900 /// {@inheritDoc}
1901 @Override

Callers

nothing calls this directly

Calls 2

disposeMethod · 0.95
isDisposesDialogMethod · 0.80

Tested by

no test coverage detected