com.vaadin.client.WidgetUtil Java Examples

The following examples show how to use com.vaadin.client.WidgetUtil. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleElementBindingStrategy.java    From flow with Apache License 2.0 6 votes vote down vote up
private void handlePropertiesChanged(
        JavaScriptObject changedPropertyPathsToValues, StateNode node) {
    String[] keys = WidgetUtil.getKeys(changedPropertyPathsToValues);

    Runnable runnable = () -> {
        for (String propertyName : keys) {
            handlePropertyChange(propertyName,
                    () -> WidgetUtil.getJsProperty(
                            changedPropertyPathsToValues, propertyName),
                    node);
        }
    };

    InitialPropertyUpdate initialUpdate = node
            .getNodeData(InitialPropertyUpdate.class);
    if (initialUpdate == null) {
        runnable.run();
    } else {
        initialUpdate.setCommand(runnable);
    }
}
 
Example #2
Source File: WeekGrid.java    From calendar-component with Apache License 2.0 6 votes vote down vote up
public void setWidthPX(int width) {
    if (isHorizontalScrollable()) {
        updateCellWidths();

        // Otherwise the scroll wrapper is somehow too narrow = horizontal
        // scroll
        wrapper.setWidth(content.getOffsetWidth() + WidgetUtil.getNativeScrollbarSize() + "px");

        this.width = content.getOffsetWidth() - timebar.getOffsetWidth();

    } else {
        this.width = (width == -1) ? width
                : width - timebar.getOffsetWidth();

        if (isVerticalScrollable() && width != -1) {
            this.width = this.width - WidgetUtil.getNativeScrollbarSize();
        }
        updateCellWidths();
    }
}
 
Example #3
Source File: CalendarWeekDropHandler.java    From calendar-component with Apache License 2.0 6 votes vote down vote up
/**
 * Checks if the location is a valid drop location
 *
 * @param elementOver
 *            The element to check
 * @return
 */
private boolean isLocationValid(Element elementOver) {
    Element weekGridElement = calendarConnector.getWidget().getWeekGrid()
            .getElement();
    Element timeBarElement = calendarConnector.getWidget().getWeekGrid()
            .getTimeBar().getElement();

    Element todayBarElement = null;
    if (calendarConnector.getWidget().getWeekGrid().hasToday()) {
        todayBarElement = calendarConnector.getWidget().getWeekGrid()
                .getDateCellOfToday().getTodaybarElement();
    }

    // drops are not allowed in:
    // - weekday header
    // - allday event list
    // - todaybar
    // - timebar
    // - items
    return DOM.isOrHasChild(weekGridElement, elementOver)
            && !DOM.isOrHasChild(timeBarElement, elementOver)
            && todayBarElement != elementOver
            && (WidgetUtil.findWidget(elementOver,
                    DateCellDayItem.class) == null);
}
 
Example #4
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Gets the visible row in the popup as a HTML string. The string
 * contains an image tag with the rows icon (if an icon has been
 * specified) and the caption of the item
 */

@Override
public String getDisplayString() {
	final StringBuilder sb = new StringBuilder();
	ApplicationConnection client = VComboBoxMultiselect.this.connector.getConnection();
	final Icon icon = client.getIcon(client.translateVaadinUri(this.untranslatedIconUri));
	if (icon != null) {
		sb.append(icon.getElement()
			.getString());
	}
	String content;
	if ("".equals(this.caption)) {
		// Ensure that empty options use the same height as other
		// options and are not collapsed (#7506)
		content = " ";
	} else {
		content = WidgetUtil.escapeHTML(this.caption);
	}
	sb.append("<span>" + content + "</span>");
	return sb.toString();
}
 
Example #5
Source File: GwtPolymerModelTest.java    From flow with Apache License 2.0 6 votes vote down vote up
public void testUpdateModelProperty_propertyIsNotUpdatable_propertyIsNotSync() {
    emulatePolymerNotLoaded();
    addMockMethods(element);

    String propertyName = "black";
    String propertyValue = "coffee";

    setModelProperty(node, propertyName, propertyValue);

    Binder.bind(node, element);
    Reactive.flush();
    assertEquals(
            "Expected to have property with name " + propertyName
                    + " defined after initial binding",
            propertyValue, WidgetUtil.getJsProperty(element, propertyName));

    emulatePolymerPropertyChange(element, propertyName, "doesNotMatter");
    Reactive.flush();
    assertEquals(
            "Expected the property with name " + propertyName
                    + " not to be updated since it's not updatable",
            propertyValue, WidgetUtil.getJsProperty(element, propertyName));
}
 
Example #6
Source File: CubaPopupButtonConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
protected void handleMouseOver(@SuppressWarnings("unused") Event.NativePreviewEvent event, Element target) {
    if (!getState().customLayout && getWidget().popupHasChild(target)) {
        Widget widget = WidgetUtil.findWidget(target, null);
        if ((widget instanceof VButton
                || widget instanceof VUpload
                || widget instanceof CubaFileUploadWidget)) {

            VButton button;
            if (widget instanceof VButton) {
                button = (VButton) widget;
            } else if (widget instanceof CubaFileUploadWidget) {
                button = ((CubaFileUploadWidget) widget).getSubmitButton();
            } else {
                button = ((VUpload) widget).submitButton;
            }
            if (!button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
                getWidget().childWidgetFocused(button);
                button.setFocus(true);
            }
        }
    }
}
 
Example #7
Source File: CubaFieldGroupLayoutComponentSlot.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public int getUsedWidth() {
    if (!isCaptionInline()) {
        return super.getUsedWidth();
    }

    int widgetWidth = getWidgetWidth();
    if (getCaption() == null) {
        return widgetWidth;
    } else if (getCaption().shouldBePlacedAfterComponent() || isCaptionInline()) {
        widgetWidth += getCaptionWidth();
        if (rightCaption != null) {
            widgetWidth += WidgetUtil.getRequiredWidth(rightCaption);
        }
        return widgetWidth;
    } else {
        if (rightCaption != null) {
            widgetWidth += WidgetUtil.getRequiredWidth(rightCaption);
        }
        return Math.max(widgetWidth, getCaptionWidth());
    }
}
 
Example #8
Source File: SimpleElementBindingStrategy.java    From flow with Apache License 2.0 6 votes vote down vote up
private void updateProperty(MapProperty mapProperty, Element element) {
    String name = mapProperty.getName();
    if (mapProperty.hasValue()) {
        Object treeValue = mapProperty.getValue();
        Object domValue = WidgetUtil.getJsProperty(element, name);
        // We compare with the current property to avoid setting properties
        // which are updated on the client side, e.g. when synchronizing
        // properties to the server (won't work for readonly properties).
        if (WidgetUtil.isUndefined(domValue)
                || !Objects.equals(domValue, treeValue)) {
            Reactive.runWithComputation(null,
                    () -> WidgetUtil.setJsProperty(element, name,
                            PolymerUtils.createModelTree(treeValue)));
        }
    } else if (WidgetUtil.hasOwnJsProperty(element, name)) {
        WidgetUtil.deleteJsProperty(element, name);
    } else {
        // Can't delete inherited property, so instead just clear
        // the value
        WidgetUtil.setJsProperty(element, name, null);
    }
}
 
Example #9
Source File: CubaMainTabSheetConnector.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
    super.init();

    getWidget().tabContextMenuHandler = (tabIndex, event) -> {
        lastContextMenuX = WidgetUtil.getTouchOrMouseClientX(event.getNativeEvent());
        lastContextMenuY = WidgetUtil.getTouchOrMouseClientY(event.getNativeEvent());

        if (getState().hasActionsHandlers) {
            rpc.onTabContextMenu(tabIndex);

            event.stopPropagation();
            event.preventDefault();
        }
    };
}
 
Example #10
Source File: GwtMultipleBindingTest.java    From flow with Apache License 2.0 6 votes vote down vote up
public void testBindModelPropertiesDoubleBind() {
    String name = "custom-div";
    Element element = Browser.getDocument().createElement(name);
    WidgetUtil.setJsProperty(element, "localName", name);
    initPolymer(element);

    NativeFunction function = NativeFunction.create("");
    WidgetUtil.setJsProperty(element, "set", function);

    Binder.bind(node, element);

    node.getMap(NodeFeatures.ELEMENT_PROPERTIES).getProperty("foo")
            .setValue("bar");

    Reactive.flush();

    node.setBound();
    Binder.bind(node, element);
}
 
Example #11
Source File: ClientJsonCodec.java    From flow with Apache License 2.0 6 votes vote down vote up
/**
 * Helper for encoding any "primitive" value that is directly supported in
 * JSON. Supported values types are {@link String}, {@link Number},
 * {@link Boolean}, {@link JsonValue}. <code>null</code> is also supported.
 *
 * @param value
 *            the value to encode
 * @return the value encoded as JSON
 */
public static JsonValue encodeWithoutTypeInfo(Object value) {
    if (value == null) {
        // undefined shouln't go as undefined, it should be encoded as null
        return Json.createNull();
    } else if (GWT.isScript()) {
        return WidgetUtil.crazyJsoCast(value);
    } else {
        if (value instanceof String) {
            return Json.create((String) value);
        } else if (value instanceof Number) {
            return Json.create(((Number) value).doubleValue());
        } else if (value instanceof Boolean) {
            return Json.create(((Boolean) value).booleanValue());
        } else if (value instanceof JsonValue) {
            return (JsonValue) value;
        }
        throw new IllegalArgumentException(
                "Can't encode" + value.getClass() + " to json");
    }
}
 
Example #12
Source File: CubaSideMenuWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void onBrowserEvent(Event event) {
    super.onBrowserEvent(event);

    if (isEnabled()) {
        switch (DOM.eventGetType(event)) {
            case Event.ONMOUSEOVER:
                Element targetElement = DOM.eventGetTarget(event);
                Object targetWidget = WidgetUtil.findWidget(targetElement, null);
                if (targetWidget instanceof MenuItemWidget) {
                    setFocusedItem((MenuItemWidget) targetWidget);
                }
                break;
            case Event.ONMOUSEOUT:
                if (!focused) {
                    setFocusedItem(null);
                }
                break;
        }
    }
}
 
Example #13
Source File: NodeMap.java    From flow with Apache License 2.0 6 votes vote down vote up
@Override
public JsonValue convert(Function<Object, JsonValue> converter) {
    JsonObject json = WidgetUtil.createJsonObject();

    properties.forEach((property, name) -> {
        if (property.hasValue()) {
            // Crazy cast since otherwise SDM fails for string values since
            // String is not a JSO
            JsonValue jsonValue = WidgetUtil
                    .crazyJsoCast(converter.apply(property.getValue()));
            json.put(name, jsonValue);
        }
    });

    return json;
}
 
Example #14
Source File: NodeMap.java    From flow with Apache License 2.0 6 votes vote down vote up
@Override
public JsonValue getDebugJson() {
    JsonObject json = WidgetUtil.createJsonObject();

    properties.forEach((p, n) -> {
        if (p.hasValue()) {
            json.put(n, getAsDebugJson(p.getValue()));
        }
    });

    if (json.keys().length == 0) {
        return null;
    }

    return json;
}
 
Example #15
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 6 votes vote down vote up
/**
 * Update minimum width for combo box textarea based on input prompt and
 * suggestions.
 * <p>
 * For internal use only. May be removed or replaced in the future.
 */
public void updateSuggestionPopupMinWidth() {
	debug("VComboBoxMultiselect: updateSuggestionPopupMinWidth()");

	// used only to calculate minimum width
	String captions = WidgetUtil.escapeHTML(this.inputPrompt);

	for (ComboBoxMultiselectSuggestion suggestion : this.currentSuggestions) {
		// Collect captions so we can calculate minimum width for
		// textarea
		if (captions.length() > 0) {
			captions += "|";
		}
		captions += WidgetUtil.escapeHTML(suggestion.getReplacementString());
	}

	// Calculate minimum textarea width
	this.suggestionPopupMinWidth = minWidth(captions);
}
 
Example #16
Source File: XhrConnection.java    From flow with Apache License 2.0 6 votes vote down vote up
/**
 * Sends an asynchronous UIDL request to the server using the given URI.
 *
 * @param payload
 *            The URI to use for the request. May includes GET parameters
 */
public void send(JsonObject payload) {
    XhrResponseHandler responseHandler = createResponseHandler();
    responseHandler.setPayload(payload);
    responseHandler.setRequestStartTime(Profiler.getRelativeTimeMillis());

    String payloadJson = WidgetUtil.stringify(payload);
    XMLHttpRequest xhr = Xhr.post(getUri(), payloadJson,
            JsonConstants.JSON_CONTENT_TYPE, responseHandler);

    Console.log("Sending xhr message to server: " + payloadJson);

    if (webkitMaybeIgnoringRequests && BrowserInfo.get().isWebkit()) {
        final int retryTimeout = 250;
        new Timer() {
            @Override
            public void run() {
                // Use native js to access private field in Request
                if (resendRequest(xhr) && webkitMaybeIgnoringRequests) {
                    // Schedule retry if still needed
                    schedule(retryTimeout);
                }
            }
        }.schedule(retryTimeout);
    }
}
 
Example #17
Source File: VDDAccordion.java    From cuba with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 * 
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    if (event.getElementOver() == null) {
        return;
    }

    StackItem tab = WidgetUtil.findWidget(event.getElementOver(),
            StackItem.class);

    if (tab != null && getElement().isOrHasChild(tab.getElement())) {
        Map<String, Object> dropDetails = event.getDropDetails();

        int index = getTabPosition(tab);
        dropDetails.put(Constants.DROP_DETAIL_TO, index);

        VerticalDropLocation location = getDropLocation(tab, event);
        dropDetails.put(Constants.DROP_DETAIL_VERTICAL_DROP_LOCATION,
                location);

        MouseEventDetails details = MouseEventDetailsBuilder
                .buildMouseEventDetails(event.getCurrentGwtEvent(),
                        getElement());
        dropDetails.put(Constants.DROP_DETAIL_MOUSE_EVENT,
                details.serialize());
    }
}
 
Example #18
Source File: VDDPanel.java    From cuba with Apache License 2.0 6 votes vote down vote up
/**
 * Updates the drop details while dragging. This is needed to ensure client
 * side criterias can validate the drop location.
 * 
 * @param event
 *            The drag event
 */
protected void updateDragDetails(VDragEvent event) {
    Element over = event.getElementOver();

    Widget content = WidgetUtil.findWidget(over, null);

    if (content != null && content != this) {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS,
                content.getClass().getName());
    } else {
        event.getDropDetails().put(Constants.DROP_DETAIL_OVER_CLASS,
                this.getClass().getName());
    }

    // Add mouse event details
    MouseEventDetails details = MouseEventDetailsBuilder
            .buildMouseEventDetails(event.getCurrentGwtEvent(),
                    getElement());
    event.getDropDetails().put(Constants.DROP_DETAIL_MOUSE_EVENT,
            details.serialize());
}
 
Example #19
Source File: CubaCaptionWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public int getRenderedWidth() {
    int width = 0;

    if (icon != null) {
        width += WidgetUtil.getRequiredWidth(icon.getElement());
    }

    if (captionText != null) {
        width += WidgetUtil.getRequiredWidth(captionText);
    }
    if (requiredFieldIndicator != null && requiredFieldIndicator.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(requiredFieldIndicator);
    }
    if (errorIndicatorElement != null && errorIndicatorElement.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(errorIndicatorElement);
    }
    if (contextHelpIndicatorElement != null && contextHelpIndicatorElement.getParentElement() == getElement()) {
        width += WidgetUtil.getRequiredWidth(contextHelpIndicatorElement);
    }
    return width;
}
 
Example #20
Source File: SimpleElementBindingStrategy.java    From flow with Apache License 2.0 5 votes vote down vote up
private void restoreInitialHiddenAttribute(Element element,
        NodeMap visibilityData) {
    MapProperty initialVisibility = storeInitialHiddenAttribute(element,
            visibilityData);
    if (initialVisibility.hasValue()) {
        WidgetUtil.updateAttribute(element, HIDDEN_ATTRIBUTE,
                initialVisibility.getValue());
    }
}
 
Example #21
Source File: DefaultReconnectDialog.java    From flow with Apache License 2.0 5 votes vote down vote up
@Override
public void setReconnecting(boolean reconnecting) {
    if (reconnecting) {
        root.getClassList().add(STYLE_RECONNECTING);
    } else {
        root.getClassList().remove(STYLE_RECONNECTING);
    }

    Element body = Browser.getDocument().getBody();
    if (reconnecting) {
        body.getClassList().add(STYLE_BODY_RECONNECTING);
    } else {
        body.getClassList().remove(STYLE_BODY_RECONNECTING);
    }

    // Click to refresh after giving up
    if (!reconnecting) {
        clickHandler = root.addEventListener("click",
                // refresh
                event -> WidgetUtil.redirect(null), false);
    } else {
        if (clickHandler != null) {
            clickHandler.remove();
            clickHandler = null;
        }
    }
}
 
Example #22
Source File: CubaTreeTableWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected Element getElementTdOrTr(Element eventTarget) {
    Widget widget = WidgetUtil.findWidget(eventTarget, null);
    Widget targetWidget = widget;

    if (widget != this) {
        /*
         * This is a workaround to make Labels, read only TextFields
         * and Embedded in a Table clickable (see #2688). It is
         * really not a fix as it does not work with a custom read
         * only components (not extending VLabel/VEmbedded).
         */
        while (widget != null && widget.getParent() != this) {
            widget = widget.getParent();
        }

        if (!(widget instanceof VLabel)
                && !(widget instanceof VEmbedded)
                && !(widget instanceof VTextField && ((VTextField) widget).isReadOnly())
                && !(targetWidget instanceof VLabel)
                && !(targetWidget instanceof Panel)
                && !(targetWidget instanceof VEmbedded)
                && !(widget instanceof CubaImageWidget)
                && !(targetWidget instanceof VTextField && ((VTextField) targetWidget).isReadOnly())) {
            return null;
        }
    }
    return getTdOrTr(eventTarget);
}
 
Example #23
Source File: StateNode.java    From flow with Apache License 2.0 5 votes vote down vote up
/**
 * Gets a JSON object representing the contents of this node. Only intended
 * for debugging purposes.
 *
 * @return a JSON representation
 */
public JsonObject getDebugJson() {
    JsonObject object = WidgetUtil.createJsonObjectWithoutPrototype();

    forEachFeature((feature, featureId) -> {
        JsonValue json = feature.getDebugJson();
        if (json != null) {
            object.put(tree.getFeatureDebugName(featureId.intValue()),
                    json);
        }
    });

    return object;
}
 
Example #24
Source File: CubaCapsLockIndicatorWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void setMessageOff(String message) {
    if (message == null || message.length() == 0) {
        removeStyleName("message-on");

        setHTML("<span></span>");
    } else {
        removeStyleName("message-on");
        addStyleName("message-off");

        setHTML("<span>" + WidgetUtil.escapeHTML(message) + "</span>");
    }
}
 
Example #25
Source File: GwtPolymerModelTest.java    From flow with Apache License 2.0 5 votes vote down vote up
public void testSetSubProperty() {
    String subProperty = "subProp";
    String value = "foo";
    setModelProperty(modelNode, subProperty, value, false);

    Binder.bind(node, element);
    Reactive.flush();

    assertEquals(value,
            WidgetUtil.getJsProperty(
                    WidgetUtil.getJsProperty(element, MODEL_PROPERTY_NAME),
                    subProperty));
}
 
Example #26
Source File: VDDAbstractOrderedLayoutDropHandler.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Slot findSlotAtPosition(int clientX, int clientY,
        NativeEvent event) {
    com.google.gwt.dom.client.Element elementUnderMouse = WidgetUtil
            .getElementFromPoint(clientX, clientY);
    if (getLayout().getElement() != elementUnderMouse) {
        return getSlot(DOM.asOld(elementUnderMouse), event);
    }
    return null;
}
 
Example #27
Source File: AtmospherePushConnection.java    From flow with Apache License 2.0 5 votes vote down vote up
@Override
public void push(JsonObject message) {
    if (!isBidirectional()) {
        throw new IllegalStateException(
                "This server to client push connection should not be used to send client to server messages");
    }
    if (state == State.CONNECTED) {
        String messageJson = WidgetUtil.stringify(message);
        Console.log("Sending push (" + transport + ") message to server: "
                + messageJson);

        if (transport.equals("websocket")) {
            FragmentedMessage fragmented = new FragmentedMessage(
                    messageJson);
            while (fragmented.hasNextFragment()) {
                doPush(socket, fragmented.getNextFragment());
            }
        } else {
            doPush(socket, messageJson);
        }
        return;
    }

    if (state == State.CONNECT_PENDING) {
        getConnectionStateHandler().pushNotConnected(message);
        return;
    }

    throw new IllegalStateException("Can not push after disconnecting");
}
 
Example #28
Source File: VDDAccordion.java    From cuba with Apache License 2.0 5 votes vote down vote up
/**
 * Emphasisizes a container element
 * 
 * @param element
 */
protected void emphasis(Element element, VDragEvent event) {

    // Find the tab
    StackItem tab = WidgetUtil.findWidget(element, StackItem.class);
    if (tab != null && getElement().isOrHasChild(tab.getElement())
            && currentlyEmphasised != tab) {
        VerticalDropLocation location = getDropLocation(tab, event);

        if (location == VerticalDropLocation.MIDDLE) {
            if (tab.isOpen()) {
                tab.addStyleName(CLASSNAME_OVER);
            } else {
                tab.getWidget(0).addStyleName(CLASSNAME_OVER);
            }
        } else if (!spacer.isAttached()) {
            if (location == VerticalDropLocation.TOP) {
                insertSpacer(spacer, getElement(), getWidgetIndex(tab));
                tab.setHeight(
                        (tab.getOffsetHeight() - spacer.getOffsetHeight())
                                + "px");
            } else if (location == VerticalDropLocation.BOTTOM) {
                insertSpacer(spacer, getElement(), getWidgetIndex(tab) + 1);
                int newHeight = tab.getOffsetHeight()
                        - spacer.getOffsetHeight();
                if (getWidgetIndex(spacer) == getWidgetCount() - 1) {
                    newHeight -= spacer.getOffsetHeight();
                }
                if (newHeight >= 0) {
                    tab.setHeight(newHeight + "px");
                }
            }
        }
        currentlyEmphasised = tab;
    }
}
 
Example #29
Source File: VDDAccordion.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public int getTabPosition(Widget tabWidget) {
    StackItem tab = WidgetUtil.findWidget(tabWidget.getElement(),
            StackItem.class);
    if (tab != null && getElement().isOrHasChild(tab.getElement())) {
        int i = 0;
        for (StackItem itm : getStackItems()) {
            if (tab == itm) {
                return i;
            }
            i++;
        }
    }
    return -1;
}
 
Example #30
Source File: ShiftCtrlClickSelectionHandler.java    From GridExtensionPack with Apache License 2.0 5 votes vote down vote up
@Override
public void onDataAvailable(DataAvailableEvent event) {

	// Perform shift selection

	int current = cell.getRowIndex();
	int min = Math.min(current, previous);
	int max = Math.max(current, previous);

	// TODO: Fix batching.

	if (!ctrlOrMeta) {
		model.deselectAll();
	}

	Range dataAvailable = event.getAvailableRows();

	Range selected = Range.between(min, max + 1);
	Range[] partition = selected.partitionWith(dataAvailable);

	for (int i = partition[1].getStart(); i < partition[1].getEnd(); ++i) {
		model.select(grid.getDataSource().getRow(i));
	}

	// TODO: Batch end

	rpc.selectRange(partition[0].getStart(), partition[0].length());
	rpc.selectRange(partition[2].getStart(), partition[2].length());

	if (handler != null) {
		handler.removeHandler();
	}

	WidgetUtil.setTextSelectionEnabled(grid.getElement(), true);
}