Search in sources :

Example 1 with HTMLLIElement

use of elemental2.dom.HTMLLIElement in project domino-ui-demo by DominoKit.

the class ThemesViewImpl method applyTheme.

private void applyTheme(Theme theme) {
    if (nonNull(activeTheme))
        activeTheme.classList.remove("active");
    HTMLLIElement themeElement = themesElements.get(theme.getKey());
    this.activeTheme = themeElement;
    themeElement.classList.add("active");
    theme.apply();
    if (nonNull(themeAppliedHandler)) {
        themeAppliedHandler.onThemeApplied(theme.getKey());
    }
}
Also used : HTMLLIElement(elemental2.dom.HTMLLIElement)

Example 2 with HTMLLIElement

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

the class StructureTypesTooltipViewTest method testMakeFieldElement.

@Test
public void testMakeFieldElement() {
    final DataType field = mock(DataType.class);
    final String typeName = "tPerson";
    final HTMLLIElement expectedHtmlLiElement = mock(HTMLLIElement.class);
    final HTMLLIElement htmlTypeElement = mock(HTMLLIElement.class);
    doReturn(expectedHtmlLiElement).when(view).makeHTMLLIElement();
    doReturn(htmlTypeElement).when(view).makeTypeElement(field);
    when(field.getName()).thenReturn(typeName);
    final HTMLLIElement actualHtmlLiElement = view.makeFieldElement(field);
    assertSame(expectedHtmlLiElement, actualHtmlLiElement);
    assertEquals(typeName, expectedHtmlLiElement.textContent);
    verify(expectedHtmlLiElement).appendChild(htmlTypeElement);
}
Also used : DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType) HTMLLIElement(elemental2.dom.HTMLLIElement) Test(org.junit.Test)

Example 3 with HTMLLIElement

use of elemental2.dom.HTMLLIElement in project domino-ui-demo by DominoKit.

the class ThemesViewImpl method setLayout.

@Override
public void setLayout(final IsLayout layout) {
    HTMLLIElement hideElement = makeIcon(Icons.HARDWARE_ICONS.keyboard_tab());
    hideElement.addEventListener("click", e -> {
        if (nonNull(Elements.label()))
            layout.hideRightPanel();
    });
    card.getHeaderBar().appendChild(hideElement);
    card.asElement().style.marginBottom = CSSProperties.MarginBottomUnionType.of(0);
    card.getBody().style.padding = CSSProperties.PaddingUnionType.of(0);
    card.getBody().appendChild(themesPanel.asElement());
    HTMLElement actionItem = Js.cast(layout.addActionItem("style").get());
    actionItem.addEventListener("click", e -> {
        layout.setRightPanelContent(themesContent());
        layout.showRightPanel();
    });
}
Also used : HTMLElement(elemental2.dom.HTMLElement) HTMLLIElement(elemental2.dom.HTMLLIElement)

Example 4 with HTMLLIElement

use of elemental2.dom.HTMLLIElement in project domino-ui-demo by DominoKit.

the class ThemesViewImpl method addTheme.

private HTMLLIElement addTheme(Theme theme, boolean active) {
    HTMLLIElement themeElement = Elements.li().add(Elements.div().css(theme.getThemeStyle().replace("theme-", ""))).add(Elements.span().textContent(theme.getName())).asElement();
    themesElements.put(theme.getKey(), themeElement);
    if (active) {
        themeElement.classList.add("active");
        activeTheme = themeElement;
        applyTheme(theme);
    }
    themesPanel.themesContainer.appendChild(themeElement);
    themeElement.addEventListener("click", evt -> {
        applyTheme(theme);
    });
    return themeElement;
}
Also used : HTMLLIElement(elemental2.dom.HTMLLIElement)

Example 5 with HTMLLIElement

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

the class StructureTypesTooltipView method makeFieldElement.

HTMLLIElement makeFieldElement(final DataType field) {
    final HTMLLIElement htmlLiElement = makeHTMLLIElement();
    final String name = field.getName();
    final HTMLElement type = makeTypeElement(field);
    htmlLiElement.textContent = name;
    htmlLiElement.appendChild(type);
    return htmlLiElement;
}
Also used : HTMLElement(elemental2.dom.HTMLElement) HTMLLIElement(elemental2.dom.HTMLLIElement)

Aggregations

HTMLLIElement (elemental2.dom.HTMLLIElement)8 HTMLElement (elemental2.dom.HTMLElement)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)1