Element createElement(final String tagName) { return DomGlobal.document.createElement(tagName); }
/** Looks for an element in the document using the CSS selector {@code [data-element=<name>]}. */ public static Element dataElement(String name) { return document.querySelector("[data-element=" + name + "]"); }
void addEventListener(final String type, final EventListener eventListener) { DomGlobal.document.addEventListener(type, eventListener); }
Text getTextNode(final String label) { return DomGlobal.document.createTextNode(label); } }
void removeEventListener(final String type, final EventListener eventListener) { DomGlobal.document.removeEventListener(type, eventListener); } }
private void initRootSvg() { hoursRootSvg = (SVGElement) document.createElementNS(SVGUtil.SVGNS, "svg"); hoursRootSvg.setAttributeNS(null, "style", "display: block; margin: auto;"); minutesRootSvg = (SVGElement) document.createElementNS(SVGUtil.SVGNS, "svg"); minutesRootSvg.setAttributeNS(null, "style", "display:none; margin: auto;"); }
public static Text empty() { return DomGlobal.document.createTextNode(""); }
public void discard() { close(); targetElement.removeEventListener(EventType.click.getName(), showListener); document.removeEventListener(EventType.click.getName(), closeListener); }
private void initRootSvg() { hoursRootSvg = (SVGElement) document.createElementNS(SVGUtil.SVGNS, "svg"); hoursRootSvg.setAttributeNS(null, "style", "display: block; margin: auto;"); minutesRootSvg = (SVGElement) document.createElementNS(SVGUtil.SVGNS, "svg"); minutesRootSvg.setAttributeNS(null, "style", "display:none; margin: auto;"); }
@Override public HTMLElement provide(final Class<?>[] classes, final Annotation[] qualifiers) { for (final Annotation annotation : qualifiers) { if (annotation.annotationType().equals(Named.class)) { final String tagName = ((Named) annotation).value(); try { return (HTMLElement) DomGlobal.document.createElement(tagName); } catch (Throwable t) { throw new RuntimeException( "An error occurred while attempting to create an element with the tag name [" + tagName + "].", t); } } } throw new RuntimeException( "Cannot provide an HTMLELement for an injection point of HTMLElement without a @Named qualifier specifying the tag name."); }
public static Text empty() { return DomGlobal.document.createTextNode(""); }
Element querySelector(final String selector) { return DomGlobal.document.querySelector(selector); }
public ScrollTop(BaseIcon<?> icon) { super(icon); init(this); circle(); setSize(ButtonSize.LARGE); setBackground(Color.THEME); style.add("top-scroller"); collapse(); addClickListener(evt -> ElementUtil.scrollTop()); document.addEventListener(EventType.scroll.getName(), evt -> { if (document.scrollingElement.scrollTop > showOffset) { ScrollTop.this.expand(); } else { ScrollTop.this.collapse(); } }); }
public void discard() { close(); targetElement.removeEventListener(EventType.click.getName(), showListener); document.removeEventListener(EventType.click.getName(), closeListener); }
public static SVGCircleElement createCircle(double x, double y, double r, String color) { SVGCircleElement circle = (SVGCircleElement) document.createElementNS(SVGNS, "circle"); circle.setAttributeNS(null, "cx", x); circle.setAttributeNS(null, "cy", y); circle.setAttributeNS(null, "r", r); circle.setAttributeNS(null, "style", "stroke: none; fill: " + color + ";"); return circle; }
@Override public HTMLElement provide(final Class<?>[] classes, final Annotation[] qualifiers) { for (final Annotation annotation : qualifiers) { if (annotation.annotationType().equals(Named.class)) { final String tagName = ((Named) annotation).value(); try { return (HTMLElement) DomGlobal.document.createElement(tagName); } catch (Throwable t) { throw new RuntimeException( "An error occurred while attempting to create an element with the tag name [" + tagName + "].", t); } } } throw new RuntimeException( "Cannot provide an HTMLELement for an injection point of HTMLElement without a @Named qualifier specifying the tag name."); }
public Tooltip(HTMLElement targetElement, String text) { this(targetElement, DomGlobal.document.createTextNode(text)); }
public SuggestBox(String type, String label, SuggestBoxStore store) { super(type, label); this.store = store; suggestionsMenu = DropDownMenu.create(getInputElement()); suggestionsMenu.addCloseHandler(this::focus); Element element = DomGlobal.document.querySelector(".content"); element.addEventListener("transitionend", evt -> { suggestionsMenu.style().setWidth(asElement().offsetWidth + "px"); }); onAttached(mutationRecord -> { suggestionsMenu.style().setWidth(asElement().offsetWidth + "px"); }); getFieldContainer().insertFirst(loaderContainer); setLoaderEffect(LoaderEffect.IOS); DelayedTextInput.create(getInputElement(), 200) .setDelayedAction(() -> { if (isEmpty()) { suggestionsMenu.close(); } else { search(); } }); }
public ScrollTop(BaseIcon<?> icon) { super(icon); init(this); circle(); setSize(ButtonSize.LARGE); setBackground(Color.THEME); style.add("top-scroller"); collapse(); addClickListener(evt -> ElementUtil.scrollTop()); document.addEventListener(EventType.scroll.getName(), evt -> { if (document.scrollingElement.scrollTop > showOffset) { ScrollTop.this.expand(); } else { ScrollTop.this.collapse(); } }); }
public static SVGCircleElement createCircle(double x, double y, double r, String color) { SVGCircleElement circle = (SVGCircleElement) document.createElementNS(SVGNS, "circle"); circle.setAttributeNS(null, "cx", x); circle.setAttributeNS(null, "cy", y); circle.setAttributeNS(null, "r", r); circle.setAttributeNS(null, "style", "stroke: none; fill: " + color + ";"); return circle; }