Search in sources :

Example 1 with EventRegistration

use of org.openremote.model.event.bus.EventRegistration in project openremote by openremote.

the class Simulator method createSimulator.

protected void createSimulator() {
    eventRegistration = environment.getEventBus().register(SimulatorState.class, simulatorState -> {
        if (!simulatorState.getProtocolConfigurationRef().equals(protocolConfiguration))
            return;
        this.simulatorState = simulatorState;
        writeView();
    });
    environment.getEventService().dispatch(new RequestSimulatorState(protocolConfiguration));
    onCreate.run();
}
Also used : Browser(elemental.client.Browser) EventRegistration(org.openremote.model.event.bus.EventRegistration) Consumer(org.openremote.model.interop.Consumer) SimulatorState(org.openremote.model.simulator.SimulatorState) java.util(java.util) ValueType(org.openremote.model.value.ValueType) Environment(org.openremote.app.client.Environment) AttributeRef(org.openremote.model.attribute.AttributeRef) ValidationFailure(org.openremote.model.ValidationFailure) org.openremote.app.client.widget(org.openremote.app.client.widget) AttributeViewImpl(org.openremote.app.client.assets.attributes.AttributeViewImpl) RequestSimulatorState(org.openremote.model.simulator.RequestSimulatorState) ShowSuccessEvent(org.openremote.app.client.event.ShowSuccessEvent) AttributeValidationResult(org.openremote.model.attribute.AttributeValidationResult) Value(org.openremote.model.value.Value) SimulatorElement(org.openremote.model.simulator.SimulatorElement) AbstractAttributeViewExtension(org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension) IsWidget(com.google.gwt.user.client.ui.IsWidget) AssetAttribute(org.openremote.model.asset.AssetAttribute) AttributeView(org.openremote.app.client.assets.attributes.AttributeView) SimulatorState(org.openremote.model.simulator.SimulatorState) RequestSimulatorState(org.openremote.model.simulator.RequestSimulatorState) RequestSimulatorState(org.openremote.model.simulator.RequestSimulatorState)

Example 2 with EventRegistration

use of org.openremote.model.event.bus.EventRegistration 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 EventRegistration

use of org.openremote.model.event.bus.EventRegistration 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

Environment (org.openremote.app.client.Environment)3 EventRegistration (org.openremote.model.event.bus.EventRegistration)3 Collection (java.util.Collection)2 Inject (javax.inject.Inject)2 AssetViewPlace (org.openremote.app.client.assets.asset.AssetViewPlace)2 ShowSuccessEvent (org.openremote.app.client.event.ShowSuccessEvent)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 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Browser (elemental.client.Browser)1 java.util (java.util)1 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 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