Browse Source

Do not push only meta data to the client (#11490)

Change-Id: I589ede89583be90e99fbed6fe5c0c6c1ac4d7c0a
tags/7.1.0.beta1
Artur Signell 11 years ago
parent
commit
874c76e4a5
2 changed files with 15 additions and 1 deletions
  1. 10
    1
      server/src/com/vaadin/ui/ConnectorTracker.java
  2. 5
    0
      server/src/com/vaadin/ui/UI.java

+ 10
- 1
server/src/com/vaadin/ui/ConnectorTracker.java View File

@@ -32,9 +32,9 @@ import org.json.JSONException;
import org.json.JSONObject;

import com.vaadin.server.AbstractClientConnector;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.ClientConnector;
import com.vaadin.server.GlobalResourceHandler;
import com.vaadin.server.LegacyCommunicationManager;
import com.vaadin.server.StreamVariable;

/**
@@ -464,6 +464,15 @@ public class ConnectorTracker implements Serializable {
return dirtyConnectors;
}

/**
* Checks if there a dirty connectors.
*
* @return true if there are dirty connectors, false otherwise
*/
public boolean hasDirtyConnectors() {
return !getDirtyConnectors().isEmpty();
}

/**
* Returns a collection of those {@link #getDirtyConnectors() dirty
* connectors} that are actually visible to the client.

+ 5
- 0
server/src/com/vaadin/ui/UI.java View File

@@ -1141,6 +1141,11 @@ public abstract class UI extends AbstractSingleComponentContainer implements
public void push() {
VaadinSession session = getSession();
if (session != null) {
if (getConnectorTracker().hasDirtyConnectors()) {
// Do not push if there is nothing to push
return;
}

if (session.getPushMode() == PushMode.DISABLED) {
throw new IllegalStateException("Push not enabled");
}

Loading…
Cancel
Save