com.github.fluorumlabs.disconnect.polymer.DomBind Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of disconnect-polymer Show documentation
Show all versions of disconnect-polymer Show documentation
Polymer 3 bindings for Disconnect Zero
package com.github.fluorumlabs.disconnect.polymer;
import com.github.fluorumlabs.disconnect.core.annotations.WebComponent;
import com.github.fluorumlabs.disconnect.polymer.elements.DomBindElement;
import com.github.fluorumlabs.disconnect.polymer.mixins.HasGestureEventListeners;
import com.github.fluorumlabs.disconnect.polymer.mixins.HasOptionalMutableData;
import com.github.fluorumlabs.disconnect.polymer.mixins.HasPropertyEffects;
import com.github.fluorumlabs.disconnect.zero.component.AbstractComponent;
import com.github.fluorumlabs.disconnect.zero.component.Component;
import com.github.fluorumlabs.disconnect.zero.component.HasComponent;
import com.github.fluorumlabs.disconnect.zero.component.Template;
import com.github.fluorumlabs.disconnect.zero.observable.ObservableEvent;
import js.web.dom.Event;
/**
* Custom element to allow using Polymer's template features (data binding, declarative event listeners, etc.) in the
* main document without defining a new custom element.
*
* <template>
tags utilizing bindings may be wrapped with the <dom-bind>
* element, which will immediately stamp the wrapped template into the main document and bind elements to the
* dom-bind
element itself as the binding scope.
*/
@WebComponent
public class DomBind
extends AbstractComponent
implements HasPropertyEffects,
HasOptionalMutableData,
HasGestureEventListeners,
HasComponent {
/**
* Instantiates a new Dom bind.
*/
public DomBind() {
super(DomBindElement.TAGNAME());
}
/**
* Instantiates a new Dom bind.
*
* @param components the components
*/
public DomBind(Component>... components) {
this();
Template template = new Template();
template.add(components);
setContent(template);
}
/**
* Forces the element to render its content. This is typically only necessary to call if HTMLImports with the async
* attribute are used.
*/
public void render() {
getNode().render();
}
/**
* Fired whenever DOM is added or removed/hidden by this template (by default, rendering occurs lazily). To force
* immediate rendering, call `render`.
*
* @return the observable event
*/
public ObservableEvent domChangeEvent() {
return createEvent("dom-change");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy