Search in sources :

Example 1 with NodeList

use of elemental2.dom.NodeList in project drools-wb by kiegroup.

the class CoverageReportDonutPresenter method manageChartLabels.

/**
 * Scope of this method is to manage the labels inside the Donut chart. The requirements is to:
 * - Remove all labels inside any arc of the chart. This is required because the chart current dimension is very
 *   small and leading to draw these labels in wrongly way.
 * To achieve these requirements without a native support of the component, it navigates the <code>container</code>
 * DOM to retrieve manually the text tags elements which handle the labels.
 */
private void manageChartLabels() {
    NodeList<Element> listE = container.getElementsByTagName("text");
    for (int i = 0; i < listE.getLength(); i++) {
        Element element = listE.getAt(i);
        String className = element.getAttribute("class");
        if (element.innerHTML != null && element.innerHTML.endsWith("%") && className.isEmpty()) {
            String style = element.getAttribute(STYLE);
            element.setAttribute(STYLE, style.concat("display:none;"));
        }
    }
}
Also used : Element(elemental2.dom.Element) HTMLDivElement(elemental2.dom.HTMLDivElement)

Example 2 with NodeList

use of elemental2.dom.NodeList in project drools-wb by kiegroup.

the class CoverageReportDonutPresenter method manageChartTooltip.

/**
 * Scope of this method is to change C3 native component position to "sticky"
 */
private void manageChartTooltip() {
    NodeList<Element> divs = container.getElementsByTagName("div");
    for (int i = 0; i < divs.getLength(); i++) {
        Element element = divs.getAt(i);
        String className = element.getAttribute("class");
        if ("c3-tooltip-container".equals(className)) {
            String style = element.getAttribute(STYLE);
            String replaceStyle = style.replace("absolute", "sticky").concat("position: -webkit-sticky;");
            element.setAttribute(STYLE, replaceStyle);
            break;
        }
    }
}
Also used : Element(elemental2.dom.Element) HTMLDivElement(elemental2.dom.HTMLDivElement)

Example 3 with NodeList

use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.

the class DragAndDropHelper method refreshItemsPosition.

void refreshItemsPosition() {
    final NodeList<Element> draggableItems = dragArea.querySelectorAll(DRAGGABLE_ITEM_CLASS);
    final int addButtonTop;
    if (!Objects.isNull(draggableItems) && draggableItems.length > 0) {
        final double itemHeight = getItemHeight((HTMLElement) draggableItems.getAt(0));
        addButtonTop = (int) (draggableItems.length * itemHeight);
        for (int i = 0; i < draggableItems.length; i++) {
            final HTMLElement element = (HTMLElement) draggableItems.getAt(i);
            final int top = (int) (position(element) * itemHeight);
            setTop(element, top);
        }
    } else {
        addButtonTop = 0;
    }
    setTop(addButtonContainer, addButtonTop);
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement)

Example 4 with NodeList

use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.

the class DataTypeListView method cleanSubTypes.

void cleanSubTypes(final String uuid) {
    final String selector = "[" + PARENT_UUID_ATTR + "=\"" + uuid + "\"]";
    final NodeList<Element> subDataTypeRows = listItems.querySelectorAll(selector);
    for (int i = 0; i < subDataTypeRows.length; i++) {
        final Element item = subDataTypeRows.getAt(i);
        if (item != null && item.parentNode != null) {
            cleanSubTypes(item.getAttribute(UUID_ATTR));
            removeDataTypeRow(item);
        }
    }
}
Also used : Element(elemental2.dom.Element) HTMLAnchorElement(elemental2.dom.HTMLAnchorElement) HTMLElement(elemental2.dom.HTMLElement) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement)

Example 5 with NodeList

use of elemental2.dom.NodeList in project kie-wb-common by kiegroup.

the class DataTypeListHighlightHelper method cleanBackgroundLine.

private void cleanBackgroundLine() {
    final NodeList<Element> elementNodeList = querySelectorAll("." + LEVEL_BACKGROUND_LINE);
    for (int i = 0; i < elementNodeList.length; i++) {
        final Element e = elementNodeList.getAt(i);
        e.parentNode.removeChild(e);
    }
}
Also used : Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement)

Aggregations

Element (elemental2.dom.Element)36 HTMLElement (elemental2.dom.HTMLElement)33 Test (org.junit.Test)24 HTMLDivElement (elemental2.dom.HTMLDivElement)18 HTMLButtonElement (elemental2.dom.HTMLButtonElement)16 DOMTokenList (elemental2.dom.DOMTokenList)15 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)9 HTMLInputElement (elemental2.dom.HTMLInputElement)8 HTMLAnchorElement (elemental2.dom.HTMLAnchorElement)7 NodeList (elemental2.dom.NodeList)4 Factory.createGripElement (org.kie.workbench.common.dmn.client.editors.types.listview.draganddrop.DNDListDOMHelper.Factory.createGripElement)4 DNDListDOMHelper.isDraggingElement (org.kie.workbench.common.dmn.client.editors.types.listview.draganddrop.DNDListDOMHelper.isDraggingElement)4 HTMLDocument (elemental2.dom.HTMLDocument)3 HTMLBodyElement (elemental2.dom.HTMLBodyElement)2 Node (elemental2.dom.Node)2 CSSStyleDeclaration (elemental2.dom.CSSStyleDeclaration)1 Window (elemental2.dom.Window)1 ArrayList (java.util.ArrayList)1 DataTypeConstraint (org.kie.workbench.common.dmn.client.editors.types.listview.constraint.DataTypeConstraint)1