Search in sources :

Example 11 with Text

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

the class DecisionNavigatorTreeViewTest method testTreeItemInitOuiaAttributes.

@Test
public void testTreeItemInitOuiaAttributes() {
    final DecisionNavigatorItem item = mock(DecisionNavigatorItem.class);
    final Text textNode = mock(Text.class);
    final String label = "label";
    final HTMLElement element = mock(HTMLElement.class);
    doReturn(element).when(treeItem).getElement();
    doReturn(item).when(treeItem).getItem();
    doReturn(DECISION).when(item).getType();
    doReturn(textNode).when(treeItem).getTextNode(label);
    when(item.getLabel()).thenReturn(label);
    treeItem.initOuiaComponentAttributes();
    verify(element).setAttribute(OuiaComponentTypeAttribute.COMPONENT_TYPE, "dmn-graph-navigator-decision");
    verify(element).setAttribute(OuiaComponentIdAttribute.COMPONENT_ID, "dmn-graph-navigator-decision-label");
}
Also used : DecisionNavigatorItem(org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Text(elemental2.dom.Text) Test(org.junit.Test)

Example 12 with Text

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

the class DataTypeListItemViewTest method testGetNameText.

@Test
public void testGetNameText() {
    final Element element = mock(Element.class);
    doReturn(element).when(view).querySelector("name-text");
    assertEquals(element, view.getNameText());
}
Also used : Element(elemental2.dom.Element) HTMLInputElement(elemental2.dom.HTMLInputElement) HTMLElement(elemental2.dom.HTMLElement) HTMLDivElement(elemental2.dom.HTMLDivElement) HTMLButtonElement(elemental2.dom.HTMLButtonElement) Test(org.junit.Test)

Example 13 with Text

use of elemental2.dom.Text 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 14 with Text

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

the class ButtonsViewImpl method initTextIconButtons.

private void initTextIconButtons() {
    Card card = Card.create("ICON & TEXT BUTTONS", "Make icon & text buttons");
    HTMLElement extension = IconButton.create(Icons.ALL.extension()).setContent("EXTENSION").asElement();
    HTMLElement home = IconButton.createPrimary(Icons.ALL.home()).setContent("HOME").asElement();
    HTMLElement lock = IconButton.createSuccess(Icons.ALL.lock()).setContent("LOCK").asElement();
    HTMLElement scanWifi = IconButton.createInfo(Icons.ALL.perm_scan_wifi()).setContent("SCAN WIFI").asElement();
    HTMLElement takeOff = IconButton.createWarning(Icons.ALL.flight_takeoff()).setContent("TAKE OFF").asElement();
    HTMLElement print = IconButton.createDanger(Icons.ALL.print()).setContent("PRINT").asElement();
    extension.style.margin = CSSProperties.MarginUnionType.of("5px");
    extension.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    home.style.margin = CSSProperties.MarginUnionType.of("5px");
    home.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    lock.style.margin = CSSProperties.MarginUnionType.of("5px");
    lock.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    scanWifi.style.margin = CSSProperties.MarginUnionType.of("5px");
    scanWifi.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    takeOff.style.margin = CSSProperties.MarginUnionType.of("5px");
    takeOff.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    print.style.margin = CSSProperties.MarginUnionType.of("5px");
    print.style.minWidth = CSSProperties.MinWidthUnionType.of("120px");
    card.appendContent(extension);
    card.appendContent(home);
    card.appendContent(lock);
    card.appendContent(scanWifi);
    card.appendContent(takeOff);
    card.appendContent(print);
    element.appendChild(card.asElement());
    element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.initTextIconButtons()).asElement());
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Card(org.dominokit.domino.ui.cards.Card)

Example 15 with Text

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

the class DialogsViewImpl method init.

@Override
public void init() {
    element.appendChild(BlockHeader.create("DIALOGS").asElement());
    Column column = Column.create().onLarge(Column.OnLarge.six).onMedium(Column.OnMedium.six).onSmall(Column.OnSmall.twelve).onXSmall(Column.OnXSmall.twelve);
    MessageDialog basicMessage = MessageDialog.createMessage("Here's a message!", () -> Notification.create("Dialog closed").show());
    MessageDialog headerAndMessage = MessageDialog.createMessage("Message header", "Here's a message body!", () -> Notification.create("Dialog closed").show());
    MessageDialog successMessage = MessageDialog.createMessage("Success Operation", "Well done! You successfully read this important alert message.", () -> Notification.create("Dialog closed").show()).success();
    MessageDialog errorMessage = MessageDialog.createMessage("Failed operation", "Oh snap! Change a few things up and try submitting again.", () -> Notification.create("Dialog closed").show()).error();
    MessageDialog customColors = MessageDialog.createMessage("Failed operation", "Oh snap! Change a few things up and try submitting again.", () -> Notification.create("Dialog closed").show()).error().setModalColor(Color.RED).setIconColor(Color.WHITE);
    MessageDialog warningMessage = MessageDialog.createMessage("Warning", "Warning! Better check yourself, you're not looking too good.", () -> Notification.create("Dialog closed").show()).warning();
    HTMLElement heart = Icons.ALL.favorite().asElement();
    heart.classList.add(Styles.font_72, Styles.m_b_15, Color.RED.getStyle());
    MessageDialog customHeaderContent = MessageDialog.createMessage("Custom header", "You can customize the header content", () -> Notification.create("Dialog closed").show()).onOpen(() -> Animation.create(heart).duration(400).infinite().transition(Transition.PULSE).animate()).appendHeaderContent(heart);
    HTMLUListElement listGroup = SimpleListGroup.create().appendItem(SimpleListItem.create("Cras justo odio").appendContent(Badge.create("14 new").setBackground(Background.PINK).asElement())).appendItem(SimpleListItem.create("Dapibus ac facilisis in").appendContent(Badge.create("99 unread").setBackground(Background.CYAN).asElement())).appendItem(SimpleListItem.create("Morbi leo risus").appendContent(Badge.create("99+").setBackground(Background.TEAL).asElement())).appendItem(SimpleListItem.create("Porta ac consectetur ac").appendContent(Badge.create("21").setBackground(Background.ORANGE).asElement())).appendItem(SimpleListItem.create("Vestibulum at eros").appendContent(Badge.create("Pending").setBackground(Background.PURPLE).asElement())).asElement();
    listGroup.style.setProperty("text-align", "left");
    MessageDialog customContent = MessageDialog.createMessage("Custom content", "You can customize the dialog content", () -> Notification.create("Dialog closed").show()).appendContent(listGroup);
    this.element.appendChild(Card.create("EXAMPLES").appendContent(Row.create().addColumn(column.copy().addElement(basicMessage.asElement()).addElement(Paragraph.create("A basic message").asElement()).addElement(createDemoButton(basicMessage))).addColumn(column.copy().addElement(headerAndMessage.asElement()).addElement(Paragraph.create("Message with header").asElement()).addElement(createDemoButton(headerAndMessage))).asElement()).appendContent(Row.create().addColumn(column.copy().addElement(successMessage.asElement()).addElement(Paragraph.create("Success message").asElement()).addElement(createDemoButton(successMessage))).addColumn(column.copy().addElement(errorMessage.asElement()).addElement(Paragraph.create("Error message").asElement()).addElement(createDemoButton(errorMessage))).asElement()).appendContent(Row.create().addColumn(column.copy().addElement(warningMessage.asElement()).addElement(Paragraph.create("Warning message").asElement()).addElement(createDemoButton(warningMessage))).addColumn(column.copy().addElement(customColors.asElement()).addElement(Paragraph.create("Custom colors").asElement()).addElement(createDemoButton(customColors))).asElement()).appendContent(Row.create().addColumn(column.copy().addElement(customHeaderContent.asElement()).addElement(Paragraph.create("Custom header content").asElement()).addElement(createDemoButton(customHeaderContent))).addColumn(column.copy().addElement(customContent.asElement()).addElement(Paragraph.create("Custom content").asElement()).addElement(createDemoButton(customContent))).asElement()).asElement());
    element.appendChild(Card.createCodeCard(CodeResource.INSTANCE.dialogs()).asElement());
}
Also used : HTMLElement(elemental2.dom.HTMLElement) Column(org.dominokit.domino.ui.column.Column) HTMLUListElement(elemental2.dom.HTMLUListElement) MessageDialog(org.dominokit.domino.ui.dialogs.MessageDialog)

Aggregations

Text (elemental2.dom.Text)15 Column (org.dominokit.domino.ui.column.Column)11 Row (org.dominokit.domino.ui.row.Row)9 HTMLDivElement (elemental2.dom.HTMLDivElement)8 Card (org.dominokit.domino.ui.cards.Card)7 UiView (org.dominokit.domino.api.client.annotations.UiView)6 ComponentView (org.dominokit.domino.componentcase.shared.extension.ComponentView)6 BlockHeader (org.dominokit.domino.ui.header.BlockHeader)6 Background (org.dominokit.domino.ui.style.Background)6 Elements (org.jboss.gwt.elemento.core.Elements)5 HTMLElement (elemental2.dom.HTMLElement)4 Icons (org.dominokit.domino.ui.icons.Icons)4 Test (org.junit.Test)4 DomGlobal (elemental2.dom.DomGlobal)3 EventListener (elemental2.dom.EventListener)3 CardsPresenter (org.dominokit.domino.cards.client.presenters.CardsPresenter)3 CardsView (org.dominokit.domino.cards.client.views.CardsView)3 CodeResource (org.dominokit.domino.cards.client.views.CodeResource)3 Button (org.dominokit.domino.ui.button.Button)3 Element (elemental2.dom.Element)2