Search in sources :

Example 1 with ShowFailureEvent

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

the class AssetsTenantActivity method onAssetSelected.

@Override
public void onAssetSelected(BrowserTreeNode treeNode) {
    if (treeNode == null || !(treeNode instanceof AssetTreeNode)) {
        this.selectedAssetId = null;
        view.setCreateAssetLinkEnabled(false);
    } else {
        AssetTreeNode assetTreeNode = (AssetTreeNode) treeNode;
        if (!assetTreeNode.getAsset().getRealmId().equals(this.realmId)) {
            environment.getEventBus().dispatch(new ShowFailureEvent(environment.getMessages().assetNotInTenant(this.tenant.getDisplayName()), 2000));
            this.selectedAssetId = null;
            view.setCreateAssetLinkEnabled(false);
            return;
        }
        this.selectedAssetId = assetTreeNode.getId();
        if (this.selectedUserId != null)
            view.setCreateAssetLinkEnabled(true);
    }
    loadUserAssets();
}
Also used : ShowFailureEvent(org.openremote.app.client.event.ShowFailureEvent)

Aggregations

ShowFailureEvent (org.openremote.app.client.event.ShowFailureEvent)1