All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.gwt.test.internal.patchers.dom.ElementMapperImplPatcher Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.internal.patchers.dom;

import com.google.gwt.dom.client.Element;
import com.google.gwt.user.client.impl.ElementMapperImpl;
import com.googlecode.gwt.test.patchers.PatchClass;
import com.googlecode.gwt.test.patchers.PatchMethod;
import com.googlecode.gwt.test.utils.JavaScriptObjects;

@PatchClass(ElementMapperImpl.class)
class ElementMapperImplPatcher {

    private static final String widgetId = "__uiObjectID";

    @PatchMethod
    static void clearIndex(Element e) {
        JavaScriptObjects.setProperty(e, widgetId, null);
        e.setPropertyString(widgetId, null);
    }

    @PatchMethod
    static int getIndex(Element e) {
        String index = JavaScriptObjects.getObject(e, widgetId);
        return index == null ? -1 : Integer.parseInt(index);
    }

    @PatchMethod
    static void setIndex(Element e, int index) {
        JavaScriptObjects.setProperty(e, widgetId, Integer.toString(index));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy