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