Search in sources :

Example 41 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class ShowAssetUsagesDisplayer method showAssetUsages.

/**
 * Displays the usages for the asset identified by the resourceFQN using a specific message instead of the default message.
 *
 * @param headerMessage The message that will be shown instead of the default message
 * @param path          Path for the given asset
 * @param resourceFQN   Fully Qualified Name of the asset
 * @param resourceType  The type of asset.
 * @param okCommand     {@link Command} that is going to run when the user presses ok button. If there are no usages on the index the command will be automatically executed without opening the modal
 * @param cancelCommand {@link Command} that is going to run when the user presses Cancel button.
 */
public void showAssetUsages(final String headerMessage, final Path path, final String resourceFQN, final ResourceType resourceType, final Command okCommand, final Command cancelCommand) {
    PortablePreconditions.checkNotNull("headerMessage", headerMessage);
    HTMLElement messageContainer = view.getDefaultMessageContainer();
    messageContainer.setInnerHTML(headerMessage);
    showAssetUsages(messageContainer, path, resourceFQN, resourceType, okCommand, cancelCommand);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement)

Example 42 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class CellEditorControlsViewImplTest method testShow.

@Test
public void testShow() {
    final PopupEditorControls editor = mock(PopupEditorControls.class);
    final int x = 10;
    final int y = 20;
    final HTMLElement element = mock(HTMLElement.class);
    doReturn(element).when(view).getElement();
    final CSSStyleDeclaration style = mock(CSSStyleDeclaration.class);
    when(element.getStyle()).thenReturn(style);
    view.show(editor, x, y);
    verify(style).setProperty(LEFT, x + PX);
    verify(style).setProperty(TOP, y + PX);
    verify(view).setOnClosedByKeyboardCallback(editor);
    verify(editor).show();
}
Also used : PopupEditorControls(org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) CSSStyleDeclaration(org.jboss.errai.common.client.dom.CSSStyleDeclaration) Test(org.junit.Test)

Example 43 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class NewAssetHandlerWidget method init.

public void init(final String title, final IsWidget iconWidget, final Command onClick) {
    text.setTextContent(title);
    if (iconWidget != null) {
        HTMLElement assetIconHtml = TemplateUtil.<HTMLElement>nativeCast(iconWidget.asWidget().getElement());
        final Node clonedAssetIconHtml = assetIconHtml.cloneNode(true);
        this.icon.appendChild(clonedAssetIconHtml);
    }
    if (onClick != null) {
        button.setOnclick(e -> onClick.execute());
    }
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Node(org.jboss.errai.common.client.dom.Node)

Example 44 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project kie-wb-common by kiegroup.

the class AssigneeEditorWidgetViewImpl method add.

@Override
public void add(final AssigneeListItem listItem) {
    HTMLElement tableRow = document.createElement("tr");
    HTMLElement liveSearchTd = document.createElement("td");
    listItem.getLiveSearchDropDown().asWidget().getElement().getStyle().setWidth(100, Style.Unit.PCT);
    DOMUtil.appendWidgetToElement(liveSearchTd, listItem.getLiveSearchDropDown());
    listItem.getLiveSearchDropDown().setEnabled(!readOnly);
    HTMLElement actionTd = document.createElement("td");
    Button button = (Button) document.createElement("button");
    button.setClassName("btn btn-link fa fa-trash");
    button.addEventListener("click", event -> {
        listItem.notifyRemoval();
        DOMUtil.removeFromParent(tableRow);
    }, false);
    button.setDisabled(readOnly);
    actionTd.appendChild(button);
    tableRow.appendChild(liveSearchTd);
    tableRow.appendChild(actionTd);
    assigneeRows.appendChild(tableRow);
    assigneeRowsElements.add(new Pair<>(listItem.getLiveSearchDropDown(), button));
    elements.put(listItem, tableRow);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Button(org.jboss.errai.common.client.dom.Button)

Example 45 with HTMLElement

use of org.jboss.errai.common.client.dom.HTMLElement in project drools-wb by kiegroup.

the class AbstractScenarioConfirmationPopupViewTest method getElement.

@Test
public void getElement() {
    final HTMLElement retrieved = popupView.getElement();
    assertNotNull(retrieved);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Aggregations

HTMLElement (org.jboss.errai.common.client.dom.HTMLElement)46 Test (org.junit.Test)29 DecisionNavigatorItem (org.kie.workbench.common.dmn.client.docks.navigator.DecisionNavigatorItem)10 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 TreeSet (java.util.TreeSet)2 Node (org.jboss.errai.common.client.dom.Node)2 LayoutComponent (org.uberfire.ext.layout.editor.api.editor.LayoutComponent)2 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 Element (elemental2.dom.Element)1 HTMLDivElement (elemental2.dom.HTMLDivElement)1 HTMLInputElement (elemental2.dom.HTMLInputElement)1 HTMLUListElement (elemental2.dom.HTMLUListElement)1 Text (elemental2.dom.Text)1 JsOverlay (jsinterop.annotations.JsOverlay)1 FlowPanel (org.gwtbootstrap3.client.ui.gwt.FlowPanel)1 Button (org.jboss.errai.common.client.dom.Button)1 CSSStyleDeclaration (org.jboss.errai.common.client.dom.CSSStyleDeclaration)1 Event (org.jboss.errai.common.client.dom.Event)1 EventListener (org.jboss.errai.common.client.dom.EventListener)1 ParameterItem (org.kie.workbench.common.dmn.client.widgets.decisionservice.parameters.parametergroup.ParameterGroup.ParameterItem)1