List of usage examples for com.vaadin.client ConnectorMap getConnector
public ComponentConnector getConnector(Widget widget)
From source file:com.haulmont.cuba.web.toolkit.ui.client.appui.AppUIConnector.java
License:Apache License
public AppUIConnector() { VNotification.setRelativeZIndex(true); registerRpc(AppUIClientRpc.class, new AppUIClientRpc() { @Override// w w w .ja v a 2s . c o m public void discardAccumulatedEvents() { // silent time ValidationErrorHolder.onValidationError(); ApplicationConnection.MethodInvocationFilter filter = new ApplicationConnection.MethodInvocationFilter() { @Override public boolean apply(MethodInvocation mi) { // use blacklist of invocations // do not discard all // button click if (ButtonServerRpc.class.getName().equals(mi.getInterfaceName()) && "click".equals(mi.getMethodName())) { return true; } // tabsheet close if (TabsheetServerRpc.class.getName().equals(mi.getInterfaceName()) && "closeTab".equals(mi.getMethodName())) { return true; } // shortcuts && window close //noinspection RedundantIfStatement if (mi instanceof LegacyChangeVariablesInvocation) { LegacyChangeVariablesInvocation invocation = (LegacyChangeVariablesInvocation) mi; if (invocation.getVariableChanges().containsKey("action") || invocation.getVariableChanges().containsKey("actiontarget") || invocation.getVariableChanges().containsKey("close")) { return true; } } return false; } }; ApplicationConnection.RemoveMethodInvocationCallback callback = new ApplicationConnection.RemoveMethodInvocationCallback() { @Override public void removed(MethodInvocation mi) { ConnectorMap connectorMap = getConnection().getConnectorMap(); ServerConnector connector = connectorMap.getConnector(mi.getConnectorId()); if (connector instanceof CubaButtonConnector) { ((CubaButtonConnector) connector).stopResponsePending(); } } }; getConnection().removePendingInvocationsAndBursts(filter, callback); } }); }
From source file:com.haulmont.cuba.web.widgets.client.appui.CubaUIConnector.java
License:Apache License
public CubaUIConnector() { // vaadin8 reimplement // VNotification.setRelativeZIndex(true); //noinspection Convert2Lambda registerRpc(CubaUIClientRpc.class, new CubaUIClientRpc() { @Override/*from www.j a v a 2s . c om*/ public void discardAccumulatedEvents() { // silent time ValidationErrorHolder.onValidationError(); // vaadin8 - get rid of this mechanism ApplicationConnection.MethodInvocationFilter filter = mi -> { // use blacklist of invocations // do not discard all // button click if (ButtonServerRpc.class.getName().equals(mi.getInterfaceName()) && "click".equals(mi.getMethodName())) { return true; } // tabsheet close if (TabsheetServerRpc.class.getName().equals(mi.getInterfaceName()) && "closeTab".equals(mi.getMethodName())) { return true; } // shortcuts && window close //noinspection RedundantIfStatement if (mi instanceof LegacyChangeVariablesInvocation) { LegacyChangeVariablesInvocation invocation = (LegacyChangeVariablesInvocation) mi; if (invocation.getVariableChanges().containsKey("action") || invocation.getVariableChanges().containsKey("actiontarget") || invocation.getVariableChanges().containsKey("close")) { return true; } } return false; }; RemoveMethodInvocationCallback callback = mi -> { ConnectorMap connectorMap = getConnection().getConnectorMap(); ServerConnector connector = connectorMap.getConnector(mi.getConnectorId()); if (connector instanceof CubaButtonConnector) { ((CubaButtonConnector) connector).stopResponsePending(); } }; getConnection().removePendingInvocationsAndBursts(filter, callback); } }); }