Search in sources :

Example 1 with HTMLElement

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

the class KieSelectElementTest method testSetup.

@Test
public void testSetup() {
    final HTMLElement viewRoot = spy(new HTMLElement());
    viewRoot.innerHTML = "bar";
    doReturn(viewRoot).when(view).getElement();
    final HTMLSelectElement selectElement = spy(new HTMLSelectElement());
    doReturn(selectElement).when(view).getSelect();
    final Element container = spy(new Element() {

        @Override
        public Node appendChild(final Node node) {
            if (node instanceof HTMLElement) {
                this.innerHTML += ((HTMLElement) node).innerHTML;
            }
            return node;
        }
    });
    container.innerHTML = "";
    final List<Option> options = singletonList(new Option("Label", "Value"));
    kieSelectElement.setup(container, options, "Value", value -> {
    });
    verify(view).setValue(eq("Value"));
    verify(view).initSelect();
    verify(optionsListPresenter).setup(eq(selectElement), eq(options), any());
    assertEquals("bar", container.innerHTML);
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Element(elemental2.dom.Element) HTMLElement(elemental2.dom.HTMLElement) HTMLSelectElement(elemental2.dom.HTMLSelectElement) Node(elemental2.dom.Node) Option(org.kie.workbench.common.screens.library.client.settings.util.KieSelectElement.Option) HTMLSelectElement(elemental2.dom.HTMLSelectElement) Test(org.junit.Test)

Example 2 with HTMLElement

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

the class AssetsScreenTest method setUp.

@Before
public void setUp() {
    WorkspaceProject projectInfo = mock(WorkspaceProject.class);
    when(libraryPlaces.getActiveWorkspaceContext()).thenReturn(projectInfo);
    EmptyAssetsView emptyView = mock(EmptyAssetsView.class);
    PopulatedAssetsView populatedView = mock(PopulatedAssetsView.class);
    HTMLElement emptyElement = mock(HTMLElement.class);
    HTMLElement populatedElement = mock(HTMLElement.class);
    when(emptyAssetsScreen.getView()).thenReturn(emptyView);
    when(emptyView.getElement()).thenReturn(emptyElement);
    when(populatedAssetsScreen.getView()).thenReturn(populatedView);
    when(populatedView.getElement()).thenReturn(populatedElement);
    this.assetsScreen = new AssetsScreen(view, libraryPlaces, emptyAssetsScreen, populatedAssetsScreen, ts, busyIndicatorView, new CallerMock<>(libraryService));
}
Also used : HTMLElement(elemental2.dom.HTMLElement) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) CallerMock(org.uberfire.mocks.CallerMock) Before(org.junit.Before)

Example 3 with HTMLElement

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

the class LabelsViewImpl method initLabels.

private void initLabels() {
    Card labels = Card.create("LABELS");
    Row row = Row.create();
    Column column = Column.create().onLarge(Column.OnLarge.one).onMedium(Column.OnMedium.two).onSmall(Column.OnSmall.six).onXSmall(Column.OnXSmall.twelve);
    HTMLElement defaultLabel = Label.createDefault("DEFAULT").asElement();
    HTMLElement primaryLabel = Label.createPrimary("PRIMARY").asElement();
    HTMLElement successLabel = Label.createSuccess("SUCCESS").asElement();
    HTMLElement infoLabel = Label.createInfo("INFO").asElement();
    HTMLElement warningLabel = Label.createWarning("WARNING").asElement();
    HTMLElement dangerLabel = Label.createDanger("DANGER").asElement();
    defaultLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    primaryLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    successLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    infoLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    warningLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    dangerLabel.style.margin = CSSProperties.MarginUnionType.of("10px");
    row.addColumn(column.addElement(defaultLabel)).addColumn(column.copy().addElement(primaryLabel)).addColumn(column.copy().addElement(successLabel)).addColumn(column.copy().addElement(infoLabel)).addColumn(column.copy().addElement(warningLabel)).addColumn(column.copy().addElement(dangerLabel));
    labels.appendContent(row.asElement());
    labels.appendContent(Elements.hr().asElement());
    HTMLHeadingElement h1 = Elements.h(1).textContent("Example heading ").asElement();
    HTMLHeadingElement h2 = Elements.h(2).textContent("Example heading ").asElement();
    HTMLHeadingElement h3 = Elements.h(3).textContent("Example heading ").asElement();
    HTMLHeadingElement h4 = Elements.h(4).textContent("Example heading ").asElement();
    HTMLHeadingElement h5 = Elements.h(5).textContent("Example heading ").asElement();
    HTMLHeadingElement h6 = Elements.h(6).textContent("Example heading ").asElement();
    h1.style.textAlign = "left";
    h1.appendChild(Label.createDanger("New").asElement());
    h2.appendChild(Label.createWarning("New").asElement());
    h3.appendChild(Label.createInfo("New").asElement());
    h4.appendChild(Label.createSuccess("New").asElement());
    h5.appendChild(Label.createPrimary("New").asElement());
    h6.appendChild(Label.createDefault("New").asElement());
    labels.appendContent(h1).appendContent(h2).appendContent(h3).appendContent(h4).appendContent(h5).appendContent(h6);
    this.element.appendChild(labels.asElement());
    element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.initLabels()).asElement());
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Column(org.dominokit.domino.ui.column.Column) Row(org.dominokit.domino.ui.row.Row) HTMLHeadingElement(elemental2.dom.HTMLHeadingElement) Card(org.dominokit.domino.ui.cards.Card)

Example 4 with HTMLElement

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

the class MenuViewImpl method init.

@Override
public void init(IsLayout layout) {
    menu = Menu.create("Demo menu");
    menu.getRoot().style.height = CSSProperties.HeightUnionType.of("calc(100vh - 250px)");
    HTMLElement leftPanel = Js.cast(layout.getLeftPanel().get());
    leftPanel.appendChild(menu.asElement());
    menu.getHeader().appendChild(lockIcon.asElement());
    menu.asElement().style.height = CSSProperties.HeightUnionType.of("calc(100vh - 237px)");
    lockIcon.asElement().addEventListener("click", evt -> {
        if (locked) {
            layout.unfixLeftPanelPosition();
            lockIcon.asElement().textContent = Icons.ALL.lock().getName();
            layout.hideLeftPanel();
            locked = false;
        } else {
            layout.fixLeftPanelPosition();
            lockIcon.asElement().textContent = Icons.ALL.lock_open().getName();
            locked = true;
        }
    });
// layout.fixLeftPanelPosition();
}
Also used : HTMLElement(elemental2.dom.HTMLElement)

Example 5 with HTMLElement

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

the class ProfileViewImpl method setLayout.

@Override
public void setLayout(IsLayout layout) {
    HTMLElement leftPanel = Js.cast(layout.getLeftPanel().get());
    if (leftPanel.childElementCount > 0)
        leftPanel.insertBefore(profile.asElement(), leftPanel.firstChild);
    else
        leftPanel.appendChild(profile.asElement());
    profile.getBody().appendChild(Elements.img(GWT.getModuleBaseURL() + "/images/user.png").style("border-radius:50%;").asElement());
    profile.getHeaderBar().appendChild(createIcon(Icons.ALL.more_vert()));
    profile.asElement().style.height = CSSProperties.HeightUnionType.of(300);
}
Also used : HTMLElement(elemental2.dom.HTMLElement)

Aggregations

HTMLElement (elemental2.dom.HTMLElement)27 Card (org.dominokit.domino.ui.cards.Card)14 Column (org.dominokit.domino.ui.column.Column)4 Row (org.dominokit.domino.ui.row.Row)4 Test (org.junit.Test)4 HTMLHeadingElement (elemental2.dom.HTMLHeadingElement)2 Element (elemental2.dom.Element)1 HTMLLIElement (elemental2.dom.HTMLLIElement)1 HTMLSelectElement (elemental2.dom.HTMLSelectElement)1 HTMLUListElement (elemental2.dom.HTMLUListElement)1 Node (elemental2.dom.Node)1 JustifiedGroup (org.dominokit.domino.ui.button.group.JustifiedGroup)1 MessageDialog (org.dominokit.domino.ui.dialogs.MessageDialog)1 GuidedDecisionTableAccordion (org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordion)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 Before (org.junit.Before)1 SettingsPresenter (org.kie.workbench.common.screens.library.client.settings.SettingsPresenter)1 KnowledgeSessionListItemPresenter (org.kie.workbench.common.screens.library.client.settings.knowledgebases.item.knowledgesessions.KnowledgeSessionListItemPresenter)1 Option (org.kie.workbench.common.screens.library.client.settings.util.KieSelectElement.Option)1 ListenerModel (org.kie.workbench.common.services.shared.kmodule.ListenerModel)1