@Bean
public ComponentRegistration chatComponent() {
return ComponentRegistrationBuilder.create(ChatComponent.class)
.withComponentLoader("chat", ChatComponentLoader.class)
.build();
}
ComponentLoader:
public class ChatComponentLoader extends AbstractComponentLoader<ChatComponent> {
@Override
protected @NotNull ChatComponent createComponent() {
return factory.create(ChatComponent.class);
}
@Override
public void loadComponent() {
loadDataContainer(resultComponent, element);
}
@SuppressWarnings({"rawtypes", "unchecked"})
protected void loadDataContainer(ChatComponent resultComponent, Element element) {
String dataContainerIsNullErrorMessage = String.format(
"%s doesn't have data binding. Set dataContainer attribute.",
resultComponent.getClass().getSimpleName()
);
String containerId = loadString(element, "dataContainer")
.orElseThrow(() -> new GuiDevelopmentException(dataContainerIsNullErrorMessage, context));
CollectionContainer container = getComponentContext().getViewData().getContainer(containerId);
if (!MessageHistory.class.isAssignableFrom(container.getEntityMetaClass().getJavaClass())) {
String improperDataBindingMessage = String.format(
"%s have improper data binding. The value for the " +
"dataContainer attribute should be associated with the Address embeddable entity.",
resultComponent.getClass().getSimpleName());
throw new GuiDevelopmentException(improperDataBindingMessage, context);
}
resultComponent.setDataContainer(container);
}
}
The createComponent() and loadComponent() methods in the ComponentLoader class are not working, I checked it in debug as well.