Java 类com.vaadin.server.ClientConnector 实例源码

项目:cuba    文件:CubaUidlWriter.java   
@SuppressWarnings("deprecation")
@Override
protected void handleAdditionalDependencies(List<Class<? extends ClientConnector>> newConnectorTypes,
                                            List<String> scriptDependencies, List<String> styleDependencies) {
    LegacyCommunicationManager manager = VaadinSession.getCurrent().getCommunicationManager();

    for (Class<? extends ClientConnector> connector : newConnectorTypes) {
        WebJarResource webJarResource = connector.getAnnotation(WebJarResource.class);
        if (webJarResource == null)
            continue;

        for (String uri : webJarResource.value()) {
            uri = processResourceUri(uri);

            if (uri.endsWith(JAVASCRIPT_EXTENSION)) {
                scriptDependencies.add(manager.registerDependency(uri, connector));
            }

            if (uri.endsWith(CSS_EXTENSION)) {
                styleDependencies.add(manager.registerDependency(uri, connector));
            }
        }
    }
}
项目:cuba    文件:WebWindow.java   
@Override
public void addTimer(Timer timer) {
    if (component.isAttached()) {
        attachTimerToUi((WebTimer) timer);
    } else {
        ClientConnector.AttachListener attachListener = new ClientConnector.AttachListener() {
            @Override
            public void attach(ClientConnector.AttachEvent event) {
                if (timers.contains(timer)) {
                    attachTimerToUi((WebTimer) timer);
                }
                // execute attach listener only once
                component.removeAttachListener(this);
            }
        };
        component.addAttachListener(attachListener);
    }

    if (timers == null) {
        timers = new LinkedList<>();
    }
    timers.add(timer);
}
项目:esup-ecandidat    文件:AppServletJMeter.java   
@SuppressWarnings("deprecation")
@Override
      public String createConnectorId(ClientConnector connector) {
          if (connector instanceof Component) {
              Component component = (Component) connector;
              return component.getId() == null ? super
                      .createConnectorId(connector) : component.getId();
          }
          return super.createConnectorId(connector);
      }
项目:cuba    文件:ComponentRenderer.java   
/**
 * When the renderer is detached from the grid (e.g. when the column is removed)
 * release all trackedComponents to make them eligible for garbage collection and remove
 * the DataGenerator extension for this renderer from the Grid.
 *
 * @param parent the parent connector
 */
@Override
public void setParent(ClientConnector parent) {

    // detect a column removal (the renderer is being detached)
    if (getParent() != null && parent == null) {

        if (!isRemovalInProgress) {

            removeAllRendererComponentsFromGrid();

            // it is important to also detach the renderers @link{DataGenerator}
            // when the renderer is detached. The @link{com.vaadin.ui.Grid.AbstractGridExtension#remove}
            // does that, but calls setParent(null) again, which would lead to endless recursion
            // so we set a flag that we currently are already in removal
            // and stop further calls to remove().
            //
            isRemovalInProgress = true;
            remove();
        } else {
            isRemovalInProgress = false;
        }
    }

    super.setParent(parent);

    // VERY IMPORTANT: registers the DataGenerator extension
    // with the grid. The reason the extend method is deprecated
    // with renderers is that normal gwt-based renderers should not have
    // a direct dependency to the grid. In case of the componentrenderer
    // it must have this dependency to function properly.
    if (parent != null) {
        extend(getParentGrid());
    }
}
项目:cuba    文件:WebAppMenu.java   
protected void handleAttach(ClientConnector.AttachEvent event) {
    AppUI appUi = (AppUI) component.getUI();
    if (appUi == null || !appUi.isTestMode()) {
        return;
    }

    for (Map.Entry<String, MenuItem> entry : allItemsIds.entrySet()) {
        assignTestIds(entry.getValue(), entry.getKey());
    }
}
项目:cuba    文件:WebSideMenu.java   
protected void handleAttach(ClientConnector.AttachEvent attachEvent) {
    AppUI appUi = (AppUI) component.getUI();
    if (appUi == null || !appUi.isTestMode()) {
        return;
    }

    for (CubaSideMenu.MenuItem vMenuItem : component.getMenuItems()) {
        assignCubaId(((MenuItemWrapper) vMenuItem).getMenuItem());
    }
}
项目:componentrenderer    文件:ComponentRenderer.java   
/**
 * When the renderer is detached from the grid (e.g. when the column is removed)
 * release all trackedComponents to make them eligible for garbage collection and remove
 * the DataGenerator extension for this renderer from the Grid.
 *
 * @param parent the parent connector
 */
@Override
public void setParent(ClientConnector parent) {

    // detect a column removal (the renderer is being detached)
    if (getParent() != null && parent == null) {

        if (!isRemovalInProgress) {

            removeAllRendererComponentsFromGrid();

            // it is important to also detach the renderers @link{DataGenerator}
            // when the renderer is detached. The @link{com.vaadin.ui.Grid.AbstractGridExtension#remove}
            // does that, but calls setParent(null) again, which would lead to endless recursion
            // so we set a flag that we currently are already in removal
            // and stop further calls to remove().
            //
            isRemovalInProgress = true;
            remove();
        } else {
            isRemovalInProgress = false;
        }
    }

    super.setParent(parent);

    // VERY IMPORTANT: registers the DataGenerator extension
    // with the grid. The reason the extend method is deprecated
    // with renderers is that normal gwt-based renderers should not have
    // a direct dependency to the grid. In case of the componentrenderer
    // it must have this dependency to function properly.
    if (parent != null) {
        extend(getParentGrid());
    }
}
项目:cuba    文件:ShortcutActionManager.java   
public ShortcutActionManager(ClientConnector connector) {
    super(connector);
}
项目:context-menu    文件:AbstractMenu.java   
public AbstractMenu(ClientConnector connector) {
    this.connector = connector;
}
项目:vaadin-jsclipboard-addon    文件:JSClipboard.java   
@Override
protected Class<? extends ClientConnector> getSupportedParentType() {
    return Button.class;
}
项目:eywa    文件:EywaProperty.java   
private void notifyForeignListeners(UI currentUI) {
    // TODO valueChangeListeners is accessed by other thread without locking
    if (valueChangeListeners != null) {
        final ValueChangeEvent event = new ValueChangeEvent() {
            @Override
            public Property getProperty() {
                return EywaProperty.this;
            }
        };
        for (final ValueChangeListener listener : valueChangeListeners) {
            if (listener instanceof ClientConnector) {
                final UI listenerUI = ((ClientConnector) listener).getUI();
                if (currentUI != null
                        && listenerUI != null
                        && listenerUI.getSession() == currentUI
                                .getSession()) {
                    // TODO Can call listener with UI.getCurrent() pointing
                    // to another UI in the same session
                    listener.valueChange(event);
                } else {
                    service.execute(new Runnable() {
                        @Override
                        public void run() {
                            // TODO listenerUI can be null
                            listenerUI.access(new Runnable() {
                                @Override
                                public void run() {
                                    listener.valueChange(event);
                                }
                            });
                        }
                    });
                }
            } else {
                service.execute(new Runnable() {
                    @Override
                    public void run() {
                        listener.valueChange(event);
                    }
                });
            }
        }
    }
}
项目:viritin    文件:FluentClientConnector.java   
/**
 * Adds an attach listener to this connector.
 * 
 * @param listener
 *            The attach listener
 * @return this (for method chaining)
 * @see #addAttachListener(com.vaadin.server.ClientConnector.AttachListener)
 */
public default S withAttachListener(AttachListener listener) {
    ((ClientConnector) this).addAttachListener(listener);
    return (S) this;
}
项目:viritin    文件:FluentClientConnector.java   
/**
 * Adds a detach listener to this connector.
 * 
 * @param listener
 *            The detach listener
 * @return this (for method chaining)
 * @see #addDetachListener(com.vaadin.server.ClientConnector.DetachListener)
 */
public default S withDetachListener(DetachListener listener) {
    ((ClientConnector) this).addDetachListener(listener);
    return (S) this;
}