}
}
+ /**
+ * Checks if there is some work to be done on the client side
+ *
+ * @return true if the client has some work to be done, false otherwise
+ */
+ private boolean isActive() {
+ return isWorkPending() || hasActiveRequest()
+ || isExecutingDeferredCommands();
+ }
+
private native void initializeTestbenchHooks(
ComponentLocator componentLocator, String TTAppId)
/*-{
var ap = this;
var client = {};
client.isActive = $entry(function() {
- return ap.@com.vaadin.client.ApplicationConnection::hasActiveRequest()()
- || ap.@com.vaadin.client.ApplicationConnection::isExecutingDeferredCommands()();
+ return ap.@com.vaadin.client.ApplicationConnection::isActive()();
});
var vi = ap.@com.vaadin.client.ApplicationConnection::getVersionInfo()();
if (vi) {
}
}
+ /**
+ * Checks if the client has running or scheduled commands
+ */
+ private boolean isWorkPending() {
+ ConnectorMap connectorMap = getConnectorMap();
+ JsArrayObject<ServerConnector> connectors = connectorMap
+ .getConnectorsAsJsArray();
+ int size = connectors.size();
+ for (int i = 0; i < size; i++) {
+ ServerConnector conn = connectors.get(i);
+ ComponentConnector compConn = null;
+ if (conn instanceof ComponentConnector) {
+ compConn = (ComponentConnector) conn;
+ Widget wgt = compConn.getWidget();
+ if (wgt instanceof DeferredWorker) {
+ if (((DeferredWorker) wgt).isWorkPending()) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
/**
* Checks if deferred commands are (potentially) still being executed as a
* result of an update from the server. Returns true if a deferred command
if (json.containsKey("typeMappings")) {
configuration.addComponentMappings(
json.getValueMap("typeMappings"), widgetSet);
+
}
VConsole.log("Handling resource dependencies");
for (int i = 0; i < needsUpdateLength; i++) {
String childId = dump.get(i);
ServerConnector child = connectorMap.getConnector(childId);
+
if (child instanceof ComponentConnector
&& ((ComponentConnector) child)
.delegateCaptionHandling()) {
--- /dev/null
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client;
+
+/**
+ * Give widgets the possibility to indicate to the framework that there is work
+ * scheduled to be executed in the near future and that the framework should
+ * wait for this work to complete before assuming the UI has reached a steady
+ * state.
+ */
+public interface DeferredWorker {
+ /**
+ * @returns true, if there are operations pending which must be executed
+ * before reaching a steady state
+ */
+ public boolean isWorkPending();
+}
import com.vaadin.client.BrowserInfo;
import com.vaadin.client.ComponentConnector;
import com.vaadin.client.ConnectorMap;
+import com.vaadin.client.DeferredWorker;
import com.vaadin.client.Focusable;
import com.vaadin.client.MouseEventDetailsBuilder;
import com.vaadin.client.StyleConstants;
*/
public class VScrollTable extends FlowPanel implements HasWidgets,
ScrollHandler, VHasDropHandler, FocusHandler, BlurHandler, Focusable,
- ActionOwner, SubPartAware {
+ ActionOwner, SubPartAware, DeferredWorker {
public static final String STYLENAME = "v-table";
addCloseHandler.removeHandler();
}
}
+
+ /*
+ * Return true if component need to perform some work and false otherwise.
+ */
+ @Override
+ public boolean isWorkPending() {
+ return lazyAdjustColumnWidths.isRunning();
+ }
}