类com.vaadin.server.Extension源码实例Demo

下面列出了怎么用com.vaadin.server.Extension的API类实例代码及写法,或者点击链接到github查看源代码。

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;
}
 
源代码2 项目: viritin   文件: MGrid.java
/**
 * Manually forces refresh of the row that represents given entity.
 * ListContainer backing MGrid/MTable don't support property change
 * listeners (to save memory and CPU cycles). In some case with Grid, if you
 * know only certain row(s) are changed, you can make a smaller client side
 * change by refreshing rows with this method, instead of refreshing the
 * whole Grid (e.g. by re-assigning the bean list).
 * <p>
 * This method is automatically called if you use "editor row".
 *
 * @param bean the bean whose row should be refreshed.
 */
public void refreshRow(T bean) {
    Collection<Extension> extensions = getExtensions();
    for (Extension extension : extensions) {
        // Calling with reflection for 7.6-7.5 compatibility
        if (extension.getClass().getName().contains(
                "RpcDataProviderExtension")) {
            try {
                Method method = extension.getClass().getMethod(
                        "updateRowData", Object.class);
                method.invoke(extension, bean);
                break;
            } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                Logger.getLogger(MGrid.class.getName()).
                        log(Level.SEVERE, null, ex);
            }
        }
    }
}
 
源代码3 项目: viritin   文件: MGrid.java
/**
 * Manually forces refresh of all visible rows. ListContainer backing
 * MGrid/MTable don't support property change listeners (to save memory and
 * CPU cycles). This method explicitly forces Grid's row cache invalidation.
 */
public void refreshVisibleRows() {
    Collection<Extension> extensions = getExtensions();
    for (Extension extension : extensions) {
        // Calling with reflection for 7.6-7.5 compatibility
        if (extension.getClass().getName().contains(
                "RpcDataProviderExtension")) {
            try {
                Method method = extension.getClass().getMethod(
                        "refreshCache");
                method.invoke(extension);
                break;
            } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
                Logger.getLogger(MGrid.class.getName()).
                        log(Level.SEVERE, null, ex);
            }
        }
    }
}
 
源代码4 项目: cuba   文件: HtmlAttributesExtension.java
public static HtmlAttributesExtension get(Component component) {
    for (Extension e : component.getExtensions()) {
        if (e instanceof HtmlAttributesExtension) {
            return (HtmlAttributesExtension) e;
        }
    }
    return new HtmlAttributesExtension((AbstractClientConnector) component);
}
 
源代码5 项目: jpa-invoicer   文件: VaadinUI.java
protected void workaroundForFirefoxIssue(boolean initial) {
    if (initial && Page.getCurrent().getWebBrowser().getBrowserApplication().
            contains("Firefox")) {
        // Responsive, FF, cross site is currently broken :-(
        Extension r = null;
        for (Extension ext : getExtensions()) {
            if (ext instanceof Responsive) {
                r = ext;
            }
        }
        removeExtension(r);
    }
}
 
源代码6 项目: serverside-elements   文件: ElementIntegration.java
public static Root getRoot(AbstractComponent target) {
    Optional<Extension> existing = target.getExtensions().stream()
            .filter(e -> e.getClass() == ElementIntegration.class)
            .findFirst();
    ElementIntegration integration = existing.isPresent() ? (ElementIntegration) existing
            .get() : new ElementIntegration(target);

    return integration.root;
}
 
源代码7 项目: cuba   文件: ContextMenu.java
@Override
protected void addExtension(Extension extension) {
    ContextMenu.this.addExtension(extension);
}
 
源代码8 项目: context-menu   文件: ContextMenu.java
@Override
protected void addExtension(Extension extension) {
    ContextMenu.this.addExtension(extension);
}