当前位置: 首页>>代码示例>>Java>>正文


Java HTMLElement类代码示例

本文整理汇总了Java中org.teavm.jso.dom.html.HTMLElement的典型用法代码示例。如果您正苦于以下问题:Java HTMLElement类的具体用法?Java HTMLElement怎么用?Java HTMLElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HTMLElement类属于org.teavm.jso.dom.html包,在下文中一共展示了HTMLElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeValueChangeListener

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void removeValueChangeListener(ValueChangeListener<String> listener) {
    if (valueChangeListeners != null) {
        if (valueChangeListeners == listener) {
            HTMLElement htmlElement = (HTMLElement) element;
            htmlElement.removeEventListener("change", changeListener);
            changeListener = null;
            valueChangeListeners = null;
        } else if (valueChangeListeners instanceof List<?>) {
            List<ValueChangeListener<String>> listeners =
                    (List<ValueChangeListener<String>>) valueChangeListeners;
            listeners.remove(listener);
            if (listeners.size() == 1) {
                valueChangeListeners = listeners.get(0);
            }
        }
    }
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:20,代码来源:DomBuilder.java

示例2: draw

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
private static void draw() {
    HTMLElement tbody = document.getElementById("list");

    while (tbody.getFirstChild() != null) {
        tbody.removeChild(tbody.getFirstChild());
    }

    for (int i = 0; i < storage.getLength(); i++) {
        String key = storage.key(i);
        String value = storage.getItem(key);

        HTMLElement tdKey = document.createElement("td").withText(key);
        HTMLElement tdValue = document.createElement("td").withText(value);
        HTMLElement tr = document.createElement("tr").withChild(tdKey).withChild(tdValue);

        tbody.appendChild(tr);
    }
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:19,代码来源:Application.java

示例3: isFullscreen

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
/**
 * @see <a href="https://robertnyman.com/2012/03/08/using-the-fullscreen-api-in-web-browsers/">Fullscreen</a>
 */
@JSBody(params = {"element"}, script = "return " +
        "document.fullscreenElement || " +
        "document.webkitFullscreenElement ||" +
        "document.mozFullScreenElement || " +
        "document.msFullscreenElement")
private static native boolean isFullscreen(HTMLElement element);
 
开发者ID:Wolftein,项目名称:Quark-Engine,代码行数:10,代码来源:WebDisplay.java

示例4: bind

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
public static Component bind(Object model, HTMLElement element) {
    Fragment fragment = create(model);
    Slot root = Slot.root(element);
    RootComponent component = new RootComponent(root, fragment.create());
    rootComponents.add(component);
    updating = true;
    try {
        component.render();
        return component;
    } finally {
        updating = false;
    }
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:14,代码来源:Templates.java

示例5: bindsLambdaToAttribute

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void bindsLambdaToAttribute() {
    ModelForLambdaToAttribute model = new ModelForLambdaToAttribute();
    Component component = Templates.bind(model, root);
    HTMLElement elem = document.getElementById("value-copy");

    model.property = "foo";
    component.render();
    assertEquals("foo", elem.getAttribute("class"));

    model.property = "bar";
    component.render();
    assertEquals("bar", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:15,代码来源:TemplateTest.java

示例6: bindsVariableToAttribute

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void bindsVariableToAttribute() {
    ModelForVariable model = new ModelForVariable();
    Component component = Templates.bind(model, root);
    HTMLElement elem = document.getElementById("value-copy");

    ExposeValueComponent.value = "foo";
    component.render();
    assertEquals("foo", elem.getAttribute("class"));

    ExposeValueComponent.value = "bar";
    component.render();
    assertEquals("bar", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:15,代码来源:TemplateTest.java

示例7: bindsLambdaToAttributeContent

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void bindsLambdaToAttributeContent() {
    ModelForAttributeLambdaToAttribute model = new ModelForAttributeLambdaToAttribute();
    Component component = Templates.bind(model, root);
    HTMLElement elem = document.getElementById("result");

    model.property = "foo";
    component.render();
    assertEquals("foo", elem.getAttribute("class"));

    model.property = "bar";
    component.render();
    assertEquals("bar", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:15,代码来源:TemplateTest.java

示例8: infersComponentTypeArgument

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void infersComponentTypeArgument() {
    ModelForComponentWithTypeParameter model = new ModelForComponentWithTypeParameter();
    model.property = new A();
    Component component = Templates.bind(model, root);
    component.render();

    HTMLElement elem = document.getElementById("type-param-component");
    assertEquals("OK", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:11,代码来源:TemplateTest.java

示例9: infersWildcardTypeArgument

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void infersWildcardTypeArgument() {
    ModelForComponentWithWildcardTypeArgument model = new ModelForComponentWithWildcardTypeArgument();
    model.property = new A();
    Component component = Templates.bind(model, root);
    component.render();

    HTMLElement elem = document.getElementById("test-component");
    assertEquals("OK;23;", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:11,代码来源:TemplateTest.java

示例10: supportsGenericAttributeComponent

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void supportsGenericAttributeComponent() {
    ModelForGenericAttributeComponent model = new ModelForGenericAttributeComponent();
    model.property = new B();

    Component component = Templates.bind(model, root);
    component.render();
    HTMLElement elem = document.getElementById("result");

    assertEquals("BBB", elem.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:12,代码来源:TemplateTest.java

示例11: infersTypeOfVariableWithWildcardType

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
@Test
public void infersTypeOfVariableWithWildcardType() {
    ModelForVariableWithWildcard model = new ModelForVariableWithWildcard();
    model.a = new A();
    model.b = new B();

    Component component = Templates.bind(model, root);
    component.render();

    HTMLElement elem1 = document.getElementById("result1");
    assertEquals("OK", elem1.getAttribute("class"));

    HTMLElement elem2 = document.getElementById("result2");
    assertEquals("BBB", elem2.getAttribute("class"));
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:16,代码来源:TemplateTest.java

示例12: toList

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
private static List<HTMLElement> toList(NodeList<? extends HTMLElement> nodeList) {
    List<HTMLElement> list = new ArrayList<>();
    for (int i = 0; i < nodeList.getLength(); ++i) {
        list.add(nodeList.get(i));
    }
    return list;
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:8,代码来源:StandardComponentsTest.java

示例13: toStrings

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
private static String[] toStrings(NodeList<? extends HTMLElement> nodeList) {
    List<HTMLElement> elements = toList(nodeList);
    String[] result = new String[elements.size()];
    for (int i = 0; i < result.length; ++i) {
        result[i] = elements.get(i).getAttribute("class");
    }
    return result;
}
 
开发者ID:konsoletyper,项目名称:teavm-flavour,代码行数:9,代码来源:StandardComponentsTest.java

示例14: makeStep

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
private static void makeStep() {
    double start = Performance.now();
    scene.calculate();
    double end = Performance.now();
    int second = (int) ((System.currentTimeMillis() - startMillisecond) / 1000);
    if (second > currentSecond) {
        HTMLElement row = document.createElement("tr");
        resultTableBody.appendChild(row);
        HTMLElement secondCell = document.createElement("td");
        row.appendChild(secondCell);
        secondCell.appendChild(document.createTextNode(String.valueOf(second)));
        HTMLElement timeCell = document.createElement("td");
        row.appendChild(timeCell);
        timeCell.appendChild(document.createTextNode(String.valueOf(timeSpentCalculating)));

        totalTime += timeSpentCalculating;
        timeSpentCalculating = 0;
        currentSecond = second;

        averageTime.withText(String.valueOf(Math.round(totalTime / second)));
    }
    timeSpentCalculating += end - start;

    if (displayAnimationCheckbox.isChecked()) {
        render();
    }

    Window.setTimeout(() -> makeStep(), scene.timeUntilNextStep());
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:30,代码来源:BenchmarkStarter.java

示例15: receiveResponse

import org.teavm.jso.dom.html.HTMLElement; //导入依赖的package包/类
private static void receiveResponse(String text) {
    HTMLElement responseElem = document.createElement("div");
    responseElem.appendChild(document.createTextNode(text));
    responsePanel.appendChild(responseElem);
    helloButton.setDisabled(false);
    thinkingPanel.getStyle().setProperty("display", "none");
}
 
开发者ID:konsoletyper,项目名称:teavm,代码行数:8,代码来源:Client.java


注:本文中的org.teavm.jso.dom.html.HTMLElement类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。