private void setTitleAttribute(final Element element, final String value) { final String attribute = "title"; element.setAttribute(attribute, value); }
Element makeTree(final Collection<DecisionNavigatorItem> items) { final Element ulElement = createElement("ul"); items.forEach(item -> { ulElement.appendChild(makeTreeItemElement(item)); }); return ulElement; }
/** Removes all child elements from {@code element} */ public static void removeChildrenFrom(Element element) { if (element != null) { while (element.firstChild != null) { element.removeChild(element.firstChild); } } }
/** * Inserts the specified element into the parent element if not already present. If parent already contains child, * this method does nothing. */ public static void lazyInsertBefore(Element parent, Element child, Element before) { if (!parent.contains(child)) { parent.insertBefore(child, before); } }
/** * Appends the specified element to the parent element if not already present. If parent already contains child, * this method does nothing. */ public static void lazyAppend(Element parent, Element child) { if (!parent.contains(child)) { parent.appendChild(child); } }
private void handleForwardTab(Event evt) { if (DominoDom.document.activeElement.equals(lastFocusElement)) { evt.preventDefault(); firstFocusElement.focus(); } }
@Override public void update(final DecisionNavigatorItem item, final DecisionNavigatorItem nextItem) { final Element parentElement = findTreeItemChildrenElement(item.getParentUUID()); final Element oldChild = findItem(item); final Element newChild = makeTreeItemElement(item); final Element refChild = findItem(nextItem); if (oldChild != null) { parentElement.removeChild(oldChild); } parentElement.insertBefore(newChild, refChild); }
public void setCallback(final String id, final T value, final Consumer<T> callback) { Scheduler.get().scheduleDeferred(() -> { final Element elementById = document.getElementById(id); if (elementById != null) { elementById.addEventListener("click", e -> callback.accept(value)); } }); }
@JsOverlay public final boolean matchesSelector(String selectors, Node refNodes) { return matchesSelector( selectors, Js.<Element.MatchesSelectorRefNodesUnionType>uncheckedCast(refNodes)); }
@Override public Element getElement() { return new Element(); } };
@Override public void addItem(final DecisionNavigatorItem item, final DecisionNavigatorItem nextItem) { final String uuid = item.getParentUUID(); final Element parentElement = findTreeItemElement(uuid); final Element parentChildrenElement = findTreeItemChildrenElement(uuid); final Element newChild = makeTreeItemElement(item); final Element refChild = findItem(nextItem); parentElement.classList.add("parent-node"); parentChildrenElement.insertBefore(newChild, refChild); }
private void handleBackwardTab(Event evt) { if (DominoDom.document.activeElement.equals(firstFocusElement)) { evt.preventDefault(); lastFocusElement.focus(); } }
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(); } }); }
/** * Inserts the specified element into the parent element if not already present. If parent already * contains child, this method does nothing. */ public static void lazyInsertAfter(Element parent, Element newElement, Element after) { if (!parent.contains(newElement)) { parent.insertBefore(newElement, after.nextSibling); } }
@JsOverlay public final boolean matchesSelector(String selectors, Node refNodes) { return matchesSelector( selectors, Js.<Element.MatchesSelectorRefNodesUnionType>uncheckedCast(refNodes)); }
@Test public void testSetup() { final Element container = spy(new Element()); final List<Option> options = Arrays.asList(new Option("FOO", "foo"), new Option("Bar", "bar")); doReturn(options).when(kieEnumSelectElement).buildOptions(any()); kieEnumSelectElement.setup( container, TestEnum.values(), TestEnum.FOO, value -> { }); assertEquals(TestEnum.class, kieEnumSelectElement.componentType); verify(kieSelectElement).setup(eq(container), eq(options), eq("FOO"), any()); }
@JsOverlay public final void addAttributes(Map<String, String> attributes) { Optional.ofNullable(attributes).ifPresent(attr -> attr.entrySet() .stream() .filter(entry -> Objects.nonNull(entry.getValue())) .forEach(entry -> this.__currentElement.setAttribute(entry.getKey(), entry.getValue()))); }
public void addPresenter(final P presenter) { presenters.add(presenter); listElement.appendChild(presenter.getView().getElement()); }
public static void clear(Element element) { if (nonNull(element)) while (nonNull(element.firstChild)) element.removeChild(element.firstChild); }
private void handleBackwardTab(Event evt) { if (DominoDom.document.activeElement.equals(firstFocusElement)) { evt.preventDefault(); lastFocusElement.focus(); } }