Search in sources :

Example 1 with Extension

use of com.vaadin.server.Extension in project cuba by cuba-platform.

the class AppUI method getTimers.

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);
        }
    }
    return timers;
}
Also used : Extension(com.vaadin.server.Extension)

Example 2 with Extension

use of com.vaadin.server.Extension in project cuba by cuba-platform.

the class CubaImageObjectFitPolyfillExtension method get.

public static CubaImageObjectFitPolyfillExtension get(UI ui) {
    CubaImageObjectFitPolyfillExtension extension = null;
    // Search singleton extension
    for (Extension uiExtension : ui.getExtensions()) {
        if (uiExtension instanceof CubaImageObjectFitPolyfillExtension) {
            extension = (CubaImageObjectFitPolyfillExtension) uiExtension;
            break;
        }
    }
    // Create new extension if not found
    if (extension == null) {
        extension = new CubaImageObjectFitPolyfillExtension();
        extension.extend(ui);
    }
    return extension;
}
Also used : Extension(com.vaadin.server.Extension) AbstractExtension(com.vaadin.server.AbstractExtension)

Example 3 with Extension

use of com.vaadin.server.Extension in project cuba by cuba-platform.

the class ComponentGridDecorator method refresh.

/**
 * Refreshes the grid preserving its current cell focus.
 *
 * @return the decorator for method chaining
 */
public ComponentGridDecorator<T> refresh() {
    focusPreserveExtension.saveFocus();
    // https://github.com/viritin/viritin/blob/viritin-1.44/src/main/java/org/vaadin/viritin/grid/MGrid.java#L218
    for (Extension extension : grid.getExtensions()) {
        if (extension instanceof RpcDataProviderExtension) {
            ((RpcDataProviderExtension) extension).refreshCache();
            break;
        }
    }
    focusPreserveExtension.restoreFocus();
    return this;
}
Also used : DetailsKeysExtension(com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.DetailsKeysExtension) Extension(com.vaadin.server.Extension) ComponentCellKeyExtension(com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.ComponentCellKeyExtension) FocusPreserveExtension(com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.FocusPreserveExtension) RpcDataProviderExtension(com.vaadin.server.communication.data.RpcDataProviderExtension) RpcDataProviderExtension(com.vaadin.server.communication.data.RpcDataProviderExtension)

Example 4 with Extension

use of com.vaadin.server.Extension in project charts by vaadin.

the class ChartOptions method get.

/**
 * Returns a ChartOptions extension for the given UI. If a ChartOptions
 * extension has not yet been added, a new one is created and added.
 *
 * @param ui
 *            the UI for which the ChartOptions should be returned
 * @return the ChartOptions instance connected to the given UI
 */
public static ChartOptions get(UI ui) {
    ChartOptions optioner = null;
    // Search singleton optioner
    for (Extension extension : ui.getExtensions()) {
        if (extension instanceof ChartOptions) {
            optioner = (ChartOptions) extension;
            break;
        }
    }
    // Create new optioner if not found
    if (optioner == null) {
        optioner = new ChartOptions();
        optioner.extendConnector(ui);
    }
    return optioner;
}
Also used : Extension(com.vaadin.server.Extension) AbstractExtension(com.vaadin.server.AbstractExtension)

Example 5 with Extension

use of com.vaadin.server.Extension in project v-leaflet by mstahv.

the class LMap method getLayersControl.

public LLayers getLayersControl() {
    for (Extension e : getExtensions()) {
        if (e instanceof LLayers) {
            return (LLayers) e;
        }
    }
    LLayers lLayers = new LLayers();
    addExtension(lLayers);
    return lLayers;
}
Also used : Extension(com.vaadin.server.Extension) LLayers(org.vaadin.addon.leaflet.control.LLayers)

Aggregations

Extension (com.vaadin.server.Extension)6 AbstractExtension (com.vaadin.server.AbstractExtension)2 ComponentCellKeyExtension (com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.ComponentCellKeyExtension)1 DetailsKeysExtension (com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.DetailsKeysExtension)1 FocusPreserveExtension (com.haulmont.cuba.web.toolkit.ui.renderers.componentrenderer.FocusPreserveExtension)1 RpcDataProviderExtension (com.vaadin.server.communication.data.RpcDataProviderExtension)1 LLayers (org.vaadin.addon.leaflet.control.LLayers)1 LZoom (org.vaadin.addon.leaflet.control.LZoom)1