use of elemental2.dom.Element in project kie-wb-common by kiegroup.
the class KieEnumSelectElementTest method testSetup.
@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());
}
use of elemental2.dom.Element 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);
}
use of elemental2.dom.Element in project mvp4g2-examples by mvp4g.
the class ShellView method setCenter.
@Override
public void setCenter(Element element) {
if (content.childElementCount > 0) {
for (int i = 0; i < content.childNodes.length; i++) {
Node oldChild = content.childNodes.item(i);
content.removeChild(oldChild);
}
}
content.appendChild(element);
}
use of elemental2.dom.Element in project domino-ui-demo by DominoKit.
the class ButtonsViewImpl method initDropUp.
private void initDropUp() {
Card card = Card.create("DROPUP VARIATION", "Trigger dropdown menus above elements.");
HTMLElement element = DropdownButton.createDefault("DEFAULT").addAction(DropdownAction.create("Action")).addAction(DropdownAction.create("Another action")).dropup().asElement();
HTMLElement primary = DropdownButton.createPrimary("PRIMARY").addAction(DropdownAction.create("Action")).addAction(DropdownAction.create("Another action")).dropup().asElement();
HTMLElement success = DropdownButton.createSuccess("SUCCESS").addAction(DropdownAction.create("Action")).addAction(DropdownAction.create("Another action")).dropup().asElement();
HTMLElement info = DropdownButton.createInfo("INFO").addAction(DropdownAction.create("Action")).addAction(DropdownAction.create("Another action")).dropup().asElement();
DropdownButton danger = DropdownButton.createDanger("Dropdown").addAction(DropdownAction.create("Action")).addAction(DropdownAction.create("Another action")).dropup();
HTMLElement group = ButtonsGroup.create().addButton(Button.createDanger("DANGER")).addDropDown(danger).asElement();
element.style.margin = CSSProperties.MarginUnionType.of("5px");
primary.style.margin = CSSProperties.MarginUnionType.of("5px");
success.style.margin = CSSProperties.MarginUnionType.of("5px");
info.style.margin = CSSProperties.MarginUnionType.of("5px");
group.style.margin = CSSProperties.MarginUnionType.of("5px");
card.appendContent(element);
card.appendContent(primary);
card.appendContent(success);
card.appendContent(info);
card.appendContent(group);
this.element.appendChild(card.asElement());
this.element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.initDropUp()).asElement());
}
use of elemental2.dom.Element in project domino-ui-demo by DominoKit.
the class CollapseViewImpl method example.
private void example() {
Collapsible collapsible = Collapsible.create(Elements.div().add(Elements.div().css("well").textContent(SAMPLE_CONTENT).asElement()).asElement());
EventListener collapsibleListener = evt -> {
if (collapsible.isCollapsed())
collapsible.expand();
else
collapsible.collapse();
};
Button anchorButton = Button.create("LINK WITH HREF");
anchorButton.justify();
anchorButton.getClickableElement().addEventListener("click", collapsibleListener);
Button button = Button.create("BUTTON");
button.getClickableElement().addEventListener("click", collapsibleListener);
element.appendChild(Row.create().addColumn(column.copy().addElement(Card.create("EXAMPLE", "click the buttons below to show and hide another element via class changes.").appendContent(anchorButton.htmlBuilder().css(CssStyles.M_B_15).component().setBackground(Background.PINK).asElement()).appendContent(new Text("\n")).appendContent(button.htmlBuilder().css(CssStyles.M_B_15).component().setBackground(Background.CYAN).asElement()).appendContent(collapsible.asElement()).asElement())).asElement());
element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.example()).asElement());
}
Aggregations