Search in sources :

Example 16 with ShowSuccessEvent

use of org.openremote.app.client.event.ShowSuccessEvent in project openremote by openremote.

the class AdminUserNotificationsActivity method onSendNotification.

@Override
public void onSendNotification() {
    // Keep it so we can send it again later
    if (this.alertNotification == null)
        this.alertNotification = createDefaultNotification();
    // TODO Constraint violation handler and @Valid AlertNotification on resource method?
    notificationEditor.setAlertNotification(this.alertNotification);
    notificationEditor.setOnSend(updatedNotification -> {
        adminContent.setFormBusy(true);
        this.alertNotification = updatedNotification;
        environment.getApp().getRequests().sendWith(alertNotificationMapper, requestParams -> notificationResource.storeNotificationForUser(requestParams, userId, this.alertNotification), 204, () -> {
            environment.getEventBus().dispatch(new ShowSuccessEvent(environment.getMessages().notificationSentToUser()));
            loadNotifications(() -> adminContent.setFormBusy(false));
        });
    });
    notificationEditor.show();
}
Also used : ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent)

Example 17 with ShowSuccessEvent

use of org.openremote.app.client.event.ShowSuccessEvent in project openremote by openremote.

the class AssetsTenantActivity method onDeleteAssetLink.

@Override
public void onDeleteAssetLink(UserAsset.Id id) {
    view.setFormBusy(true);
    environment.getApp().getRequests().sendWith(userAssetMapper, requestParams -> assetResource.deleteUserAsset(requestParams, id.getRealmId(), id.getUserId(), id.getAssetId()), 204, () -> {
        environment.getEventBus().dispatch(new ShowSuccessEvent(environment.getMessages().userAssetLinkDeleted()));
        view.setFormBusy(false);
        loadUserAssets();
    });
}
Also used : ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent)

Aggregations

ShowSuccessEvent (org.openremote.app.client.event.ShowSuccessEvent)17 AdminUsersPlace (org.openremote.app.client.admin.users.AdminUsersPlace)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Browser (elemental.client.Browser)1 java.util (java.util)1 Environment (org.openremote.app.client.Environment)1 AbstractAttributeViewExtension (org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension)1 AttributeView (org.openremote.app.client.assets.attributes.AttributeView)1 AttributeViewImpl (org.openremote.app.client.assets.attributes.AttributeViewImpl)1 org.openremote.app.client.widget (org.openremote.app.client.widget)1 ValidationFailure (org.openremote.model.ValidationFailure)1 AssetAttribute (org.openremote.model.asset.AssetAttribute)1 UserAsset (org.openremote.model.asset.UserAsset)1 AttributeRef (org.openremote.model.attribute.AttributeRef)1 AttributeValidationResult (org.openremote.model.attribute.AttributeValidationResult)1 EventRegistration (org.openremote.model.event.bus.EventRegistration)1 Consumer (org.openremote.model.interop.Consumer)1 RequestSimulatorState (org.openremote.model.simulator.RequestSimulatorState)1 SimulatorElement (org.openremote.model.simulator.SimulatorElement)1 SimulatorState (org.openremote.model.simulator.SimulatorState)1