本文整理汇总了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);
}
}
}
}
示例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);
}
}
示例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);
示例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;
}
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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"));
}
示例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;
}
示例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;
}
示例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());
}
示例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");
}