// Initialize UI components
_uriReceiverField = new EditField("Receiver URI:", PATH_STRING, 140, 0);
_isBlocking = new CheckboxField("Blocking", false);
_isBlocking.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
// Avoid conflict blocking and non-blocking destinations with
// the same name
if (_isBlocking.getChecked()) {
_uriReceiverField.setText(PATH_STRING + "9");
} else {
_uriReceiverField.setText(PATH_STRING);
}
}
});
_autoStartEnabled =
new CheckboxField("Auto-start when message arrives", true);
final FullWidthButton backButton = new FullWidthButton("Back");
backButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
((UiApplication) ReceivePushScreen.this.getApplication())
.popScreen(ReceivePushScreen.this);
}
});
final FullWidthButton startButton =
new FullWidthButton("Start Receiver");
startButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
if (_isBlocking.getChecked()) {
// Blocking receiver
controller.startBlockingReceiverBES(_uriReceiverField
.getText(), _autoStartEnabled.getChecked(),
CommunicationController.TIMEOUT);
} else {
// Non blocking receiver
controller.startNonBlockingReceiverBES(_uriReceiverField
.getText(), _autoStartEnabled.getChecked());
}
}
});
final FullWidthButton pauseButton =
new FullWidthButton("Pause Receiver");
pauseButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
controller.pauseReceiver(_uriReceiverField.getText());
}
});
final FullWidthButton resumeButton =
new FullWidthButton("Resume Receiver");
resumeButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
controller.resumeReceiver(_uriReceiverField.getText());
}
});
final FullWidthButton releaseButton =
new FullWidthButton("Release Receiver");
releaseButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
controller.releaseReceiver(_uriReceiverField.getText());
}
});
final FullWidthButton destroyButton =
new FullWidthButton("Destroy Receiver");
destroyButton.setChangeListener(new FieldChangeListener() {
/**
* @see FieldChangeListener#fieldChanged(Field, int)
*/
public void fieldChanged(final Field field, final int context) {
controller.destroyReceiver(_uriReceiverField.getText());