Search in sources :

Example 11 with HTMLElement

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

the class FormGeneratorDriverTest method testCreateComponent.

@Test
public void testCreateComponent() {
    HTMLElement column = mock(HTMLElement.class);
    LayoutComponent layoutComponent = new LayoutComponent(FieldLayoutComponent.class.getName());
    driver.createComponent(column, layoutComponent);
    verify(beanManager).lookupBeans(Mockito.<String>any());
    verify(instance).select(eq(FieldLayoutComponent.class));
    verify(wrapperWidgetUtil).getWidget(same(driver), any(HTMLElement.class));
    Assertions.assertThat(driver.getLayoutFields()).hasSize(1);
    FieldLayoutComponent fieldLayoutComponent = driver.getLayoutFields().get(0);
    verify(fieldLayoutComponent).init(eq(context), any());
    verify(fieldLayoutComponent).getShowWidget(any());
    // checking a second try
    layoutComponent = new LayoutComponent(FieldLayoutComponent.class.getName());
    driver.createComponent(column, layoutComponent);
    verify(beanManager, times(1)).lookupBeans(Mockito.<String>any());
    verify(instance, times(2)).select(eq(FieldLayoutComponent.class));
    verify(wrapperWidgetUtil, times(2)).getWidget(same(driver), any(HTMLElement.class));
    Assertions.assertThat(driver.getLayoutFields()).hasSize(2);
    fieldLayoutComponent = driver.getLayoutFields().get(1);
    verify(fieldLayoutComponent).init(eq(context), any());
    verify(fieldLayoutComponent).getShowWidget(any());
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) LayoutComponent(org.uberfire.ext.layout.editor.api.editor.LayoutComponent) Test(org.junit.Test)

Example 12 with HTMLElement

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

the class LibraryScreenTest method showNoProjectsTest.

@Test
public void showNoProjectsTest() {
    doReturn(true).when(view).isProjectsTabActive();
    doReturn(false).when(libraryService).hasProjects(any());
    final HTMLElement emptyLibraryScreenElement = mock(HTMLElement.class);
    when(emptyLibraryScreen.getView().getElement()).thenReturn(emptyLibraryScreenElement);
    libraryScreen.showProjects();
    verify(view).updateContent(emptyLibraryScreenElement);
    verify(view, times(1)).setProjectsCount(0);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Example 13 with HTMLElement

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

the class AssetItemWidget method init.

public void init(final String name, final String path, final String type, final IsWidget icon, final String lastModifiedDate, final String createdDate, final Command details, final Command select) {
    if (icon != null) {
        HTMLElement assetIconHtml = TemplateUtil.<HTMLElement>nativeCast(icon.asWidget().getElement());
        final Node clonedAssetIconHtml = assetIconHtml.cloneNode(true);
        this.assetIcon.appendChild(clonedAssetIconHtml);
    }
    this.assetName.setTextContent(name);
    this.assetName.setOnclick(e -> {
        e.stopImmediatePropagation();
        select.execute();
    });
    this.assetPath.setTextContent(path);
    this.assetType.setTextContent(type);
    this.assetLastModifiedDate.setTextContent(lastModifiedDate);
    this.assetCreatedDate.setTextContent(createdDate);
    assetContainer.setOnclick(e -> details.execute());
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Node(org.jboss.errai.common.client.dom.Node)

Example 14 with HTMLElement

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

the class AssetListPagingTest method addElementToView.

@Test
public void addElementToView() throws Exception {
    final HTMLElement element = mock(HTMLElement.class);
    assetList.add(element);
    verify(view).add(element);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) Test(org.junit.Test)

Example 15 with HTMLElement

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

the class ShowAssetUsagesDisplayer method showAssetPartUsages.

/**
 * Displays the usages for the asset part identified by the resourPart parameter 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 resourcePart  The name of the part to search.
 * @param partType      The {@link PartType} that to search.
 * @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 showAssetPartUsages(final String headerMessage, final Path path, final String resourceFQN, final String resourcePart, final PartType partType, final Command okCommand, final Command cancelCommand) {
    PortablePreconditions.checkNotNull("headerMessage", headerMessage);
    HTMLElement messageContainer = view.getDefaultMessageContainer();
    messageContainer.setInnerHTML(headerMessage);
    showAssetPartUsages(messageContainer, path, resourceFQN, resourcePart, partType, okCommand, cancelCommand);
}
Also used : HTMLElement(org.jboss.errai.common.client.dom.HTMLElement)

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