Example usage for com.vaadin.ui AbstractComponent getExtensions

List of usage examples for com.vaadin.ui AbstractComponent getExtensions

Introduction

In this page you can find the example usage for com.vaadin.ui AbstractComponent getExtensions.

Prototype

@Override
    public Collection<Extension> getExtensions() 

Source Link

Usage

From source file:com.haulmont.cuba.web.AppUI.java

License:Apache License

public List<CubaTimer> getTimers() {
    AbstractComponent timersHolder = getTopLevelWindowComposition();

    List<CubaTimer> timers = new ArrayList<>();
    for (Extension extension : timersHolder.getExtensions()) {
        if (extension instanceof CubaTimer) {
            timers.add((CubaTimer) extension);
        }//w  w  w.java 2 s.c  o  m
    }
    return timers;
}

From source file:com.haulmont.cuba.web.AppUI.java

License:Apache License

public void addTimer(CubaTimer timer) {
    AbstractComponent timersHolder = getTopLevelWindowComposition();

    if (!timersHolder.getExtensions().contains(timer)) {
        timer.extend(timersHolder);//  w w w.j a v a 2 s. c o  m
    }
}

From source file:org.vaadin.alump.masonry.ImagesLoadedExtension.java

License:Apache License

/**
 * Get instance of ImagesLoadedExtension currently extending given component.
 * @param component Component with instance of extension
 * @return Instance of ImagesLoadedExtension if found, null if no instance found
 *//*from  www  .j ava 2s. c  o  m*/
public static ImagesLoadedExtension getExtension(AbstractComponent component) {
    if (component == null) {
        throw new IllegalArgumentException("Can not resolve extension from null component");
    }
    for (Extension extension : component.getExtensions()) {
        if (extension instanceof ImagesLoadedExtension) {
            return (ImagesLoadedExtension) extension;
        }
    }
    return null;
}