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);
}
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));
}
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());
}
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();
}
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);
}
Aggregations