Record At Will
Implementation of “Record At Will” button, that will allow you to toggle Live Recording from your application
Estimated reading time: 1 min
Last edited: 12 Dec 2019
RevDeBug API allows to add user interface option to enable or disable a continuous recording mode. Using it users can record all code and it’s state triggered by their actions “from-to” moment of their choosing (ie.a full testing scenario or a reproducible issue happening on production in a remote installation location).
Example - Record At Will button
First you need to add RevDeBug to your application. To do this, follow this chapter about RevDeBug Configuration.
Application in Connectivity Type Continuous by default automatically records everything from the application start. This behaviour is controlled by the Recording Server which stores the recordings. As we would like the recording to start from the user defined moment in time the Recording Server need to have parameter CONTINUOUS_CONNECTION_STARTUP_MODE='crash' passed when launched. In case your Record Server is already running you must restart it with this parameter set
Now we can add a button, that will turn recording off and on:
buttonClick.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (RevDeBug.Storage.getStorageApi().IsActive()){
RevDeBug.Storage.getStorageApi().Deactivate();
}
else {
RevDeBug.Storage.getStorageApi().Activate();
}
}
});
In order to show visual feedback to the user, whether RevDeBug is recording at the moment you can query IsActive property:
...
buttonClick.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (RevDeBug.Storage.getStorageApi().IsActive()){
RevDeBug.Storage.getStorageApi().Deactivate();
}
else {
RevDeBug.Storage.getStorageApi().Activate();
}
}
});
}
public Boolean IsRevDeBugRecording() {
return RevDeBug.Storage.getStorageApi().IsActive();
}