Search in sources :

Example 1 with AttributeViewImpl

use of org.openremote.app.client.assets.attributes.AttributeViewImpl in project openremote by openremote.

the class AbstractAssetActivity method createAttributeView.

protected AttributeView createAttributeView(AssetAttribute attribute) {
    AttributeViewImpl attributeView = new AttributeViewImpl(environment, view.getStyle(), attribute);
    attributeView.setAttributeActions(createAttributeActions(attribute, attributeView));
    List<AbstractAttributeViewExtension> extensions = createAttributeExtensions(attribute, attributeView);
    if (extensions != null && !extensions.isEmpty()) {
        extensions.forEach(this::linkAttributeView);
    }
    attributeView.setAttributeExtensions(extensions);
    linkAttributeView(attributeView);
    return attributeView;
}
Also used : AbstractAttributeViewExtension(org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension) AttributeViewImpl(org.openremote.app.client.assets.attributes.AttributeViewImpl)

Example 2 with AttributeViewImpl

use of org.openremote.app.client.assets.attributes.AttributeViewImpl in project openremote by openremote.

the class AssetViewActivity method enableLiveUpdates.

@Override
public void enableLiveUpdates(boolean enable) {
    liveUpdates = enable;
    for (AttributeView attributeView : attributeViews) {
        if (attributeView instanceof AttributeViewImpl) {
            ((AttributeViewImpl) attributeView).getActionButtons().forEach(button -> {
                if (button.getStyleName().contains(READ_BUTTON_CLASS)) {
                    (button).setEnabled(!enable);
                }
            });
        }
    }
    if (enable) {
        // Poll all values once so we have some state
        readAllAttributeValues();
    }
    subscribeLiveUpdates(enable);
}
Also used : AttributeView(org.openremote.app.client.assets.attributes.AttributeView) AttributeViewImpl(org.openremote.app.client.assets.attributes.AttributeViewImpl)

Aggregations

AttributeViewImpl (org.openremote.app.client.assets.attributes.AttributeViewImpl)2 AbstractAttributeViewExtension (org.openremote.app.client.assets.attributes.AbstractAttributeViewExtension)1 AttributeView (org.openremote.app.client.assets.attributes.AttributeView)1