use of org.kie.workbench.common.screens.datamodeller.model.editor.ImageWrapper in project kie-wb-common by kiegroup.
the class DataObjectBrowserViewImplTest method addPropertyTypeBrowseColumn.
@Test
public void addPropertyTypeBrowseColumn() {
FieldMetadataProvider fieldMetadataProvider = objectProperty -> {
if ("testField".equals(objectProperty.getName())) {
ImageWrapper imageWrapper = new ImageWrapper("testUri", "testDescription");
FieldMetadata fieldMetadata = new FieldMetadata(imageWrapper);
return Optional.of(fieldMetadata);
}
return Optional.empty();
};
Instance<FieldMetadataProvider> fieldMetadataProviderInstance = new MockInstanceImpl<>(fieldMetadataProvider);
view = new DataObjectBrowserViewImpl(validationPopup, fieldMetadataProviderInstance);
Column<ObjectProperty, List<ImageWrapper>> column = view.createPropertyTypeBrowseColumn();
ObjectProperty matchingObjectProperty = new ObjectPropertyImpl("testField", "className", false);
List<ImageWrapper> imageWrapperList = column.getValue(matchingObjectProperty);
assertEquals(1, imageWrapperList.size());
ObjectProperty nonMatchingObjectProperty = new ObjectPropertyImpl("nonMatchingTestField", "className", false);
imageWrapperList = column.getValue(nonMatchingObjectProperty);
assertEquals(0, imageWrapperList.size());
}
use of org.kie.workbench.common.screens.datamodeller.model.editor.ImageWrapper in project kie-wb-common by kiegroup.
the class MultiImageCell method render.
@Override
public void render(final Context context, final List<ImageWrapper> imageWrappers, final SafeHtmlBuilder sb) {
for (ImageWrapper imageWrapper : imageWrappers) {
String imageBuilder = "<img src='" + imageWrapper.getUri() + "' title='" + imageWrapper.getDescription() + "' width='" + IMAGE_WIDTH + "' height='" + IMAGE_HEIGHT + "' style=\"margin-right: 5px;\">";
sb.appendHtmlConstant(imageBuilder);
}
}
Aggregations