Search in sources :

Example 1 with AssetViewPlace

use of org.openremote.app.client.assets.asset.AssetViewPlace in project openremote by openremote.

the class AssetNavigationImpl method setPresenter.

@Override
public void setPresenter(Presenter presenter) {
    this.presenter = presenter;
    viewAssetLink.removeStyleName("active");
    editAssetLink.removeStyleName("active");
    if (presenter == null) {
        navItemContainer.clear();
        viewAssetLink.setTargetHistoryToken("");
        editAssetLink.setTargetHistoryToken("");
        return;
    }
    viewAssetLink.setTargetHistoryToken(presenter.getAssetViewPlaceToken());
    editAssetLink.setTargetHistoryToken(presenter.getAssetEditPlaceToken());
    AssetPlace place = presenter.getActivePlace();
    if (place instanceof AssetViewPlace) {
        viewAssetLink.addStyleName("active");
    } else if (place instanceof AssetEditPlace) {
        editAssetLink.addStyleName("active");
    }
}
Also used : AssetEditPlace(org.openremote.app.client.assets.asset.AssetEditPlace) AssetViewPlace(org.openremote.app.client.assets.asset.AssetViewPlace) AssetPlace(org.openremote.app.client.assets.asset.AssetPlace)

Example 2 with AssetViewPlace

use of org.openremote.app.client.assets.asset.AssetViewPlace in project openremote by openremote.

the class AssetsDashboardActivity method start.

@Override
public void start(AcceptsView container, EventBus eventBus, Collection<EventRegistration> registrations) {
    view.setPresenter(this);
    container.setWidget(view.asWidget());
    registrations.add(eventBus.register(AssetBrowserSelection.class, event -> {
        if (event.getSelectedNode() instanceof TenantTreeNode) {
            environment.getPlaceController().goTo(new AssetsTenantPlace(event.getSelectedNode().getId()));
        } else if (event.getSelectedNode() instanceof AssetTreeNode) {
            environment.getPlaceController().goTo(new AssetViewPlace(event.getSelectedNode().getId()));
        }
    }));
    assetBrowserPresenter.clearSelection();
}
Also used : AssetBrowserSelection(org.openremote.app.client.assets.browser.AssetBrowserSelection) EventRegistration(org.openremote.model.event.bus.EventRegistration) AppActivity(org.openremote.app.client.mvp.AppActivity) EventBus(org.openremote.model.event.bus.EventBus) Environment(org.openremote.app.client.Environment) AssetBrowserSelection(org.openremote.app.client.assets.browser.AssetBrowserSelection) Collection(java.util.Collection) AssetViewPlace(org.openremote.app.client.assets.asset.AssetViewPlace) AssetsTenantPlace(org.openremote.app.client.assets.tenant.AssetsTenantPlace) AcceptsView(org.openremote.app.client.mvp.AcceptsView) Inject(javax.inject.Inject) AssetBrowser(org.openremote.app.client.assets.browser.AssetBrowser) AssetTreeNode(org.openremote.app.client.assets.browser.AssetTreeNode) TenantTreeNode(org.openremote.app.client.assets.browser.TenantTreeNode) AssetTreeNode(org.openremote.app.client.assets.browser.AssetTreeNode) AssetViewPlace(org.openremote.app.client.assets.asset.AssetViewPlace) TenantTreeNode(org.openremote.app.client.assets.browser.TenantTreeNode) AssetsTenantPlace(org.openremote.app.client.assets.tenant.AssetsTenantPlace)

Example 3 with AssetViewPlace

use of org.openremote.app.client.assets.asset.AssetViewPlace in project openremote by openremote.

the class AssetsTenantActivity method start.

@Override
public void start(AcceptsView container, EventBus eventBus, Collection<EventRegistration> registrations) {
    view.setPresenter(this);
    container.setWidget(view.asWidget());
    registrations.add(eventBus.register(AssetBrowserSelection.class, event -> {
        if (event.getSelectedNode() instanceof TenantTreeNode) {
            if (this.realmId == null || !this.realmId.equals(event.getSelectedNode().getId())) {
                environment.getPlaceController().goTo(new AssetsTenantPlace(event.getSelectedNode().getId()));
            }
        } else if (event.getSelectedNode() instanceof AssetTreeNode) {
            environment.getPlaceController().goTo(new AssetViewPlace(event.getSelectedNode().getId()));
        }
    }));
    loadTenant();
}
Also used : EventRegistration(org.openremote.model.event.bus.EventRegistration) Tenant(org.openremote.model.security.Tenant) User(org.openremote.model.security.User) AppActivity(org.openremote.app.client.mvp.AppActivity) TenantResource(org.openremote.model.security.TenantResource) Arrays(java.util.Arrays) EventBus(org.openremote.model.event.bus.EventBus) Environment(org.openremote.app.client.Environment) Collection(java.util.Collection) AssetViewPlace(org.openremote.app.client.assets.asset.AssetViewPlace) ShowFailureEvent(org.openremote.app.client.event.ShowFailureEvent) UserArrayMapper(org.openremote.app.client.admin.UserArrayMapper) UserAsset(org.openremote.model.asset.UserAsset) AcceptsView(org.openremote.app.client.mvp.AcceptsView) AssetBrowsingActivity(org.openremote.app.client.assets.AssetBrowsingActivity) AssetResource(org.openremote.model.asset.AssetResource) ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent) Inject(javax.inject.Inject) TenantMapper(org.openremote.app.client.TenantMapper) UserResource(org.openremote.model.security.UserResource) AdminUserEditPlace(org.openremote.app.client.admin.users.edit.AdminUserEditPlace) org.openremote.app.client.assets.browser(org.openremote.app.client.assets.browser) AssetViewPlace(org.openremote.app.client.assets.asset.AssetViewPlace)

Aggregations

AssetViewPlace (org.openremote.app.client.assets.asset.AssetViewPlace)3 Collection (java.util.Collection)2 Inject (javax.inject.Inject)2 Environment (org.openremote.app.client.Environment)2 AcceptsView (org.openremote.app.client.mvp.AcceptsView)2 AppActivity (org.openremote.app.client.mvp.AppActivity)2 EventBus (org.openremote.model.event.bus.EventBus)2 EventRegistration (org.openremote.model.event.bus.EventRegistration)2 Arrays (java.util.Arrays)1 TenantMapper (org.openremote.app.client.TenantMapper)1 UserArrayMapper (org.openremote.app.client.admin.UserArrayMapper)1 AdminUserEditPlace (org.openremote.app.client.admin.users.edit.AdminUserEditPlace)1 AssetBrowsingActivity (org.openremote.app.client.assets.AssetBrowsingActivity)1 AssetEditPlace (org.openremote.app.client.assets.asset.AssetEditPlace)1 AssetPlace (org.openremote.app.client.assets.asset.AssetPlace)1 org.openremote.app.client.assets.browser (org.openremote.app.client.assets.browser)1 AssetBrowser (org.openremote.app.client.assets.browser.AssetBrowser)1 AssetBrowserSelection (org.openremote.app.client.assets.browser.AssetBrowserSelection)1 AssetTreeNode (org.openremote.app.client.assets.browser.AssetTreeNode)1 TenantTreeNode (org.openremote.app.client.assets.browser.TenantTreeNode)1