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