use of org.jboss.errai.ioc.client.container.SyncBeanDef in project kie-wb-common by kiegroup.
the class ClientFormGenerator method initialize.
@PostConstruct
public void initialize() {
SyncBeanManager beanManager = IOC.getBeanManager();
Collection<SyncBeanDef<FormElementProcessor>> processors = beanManager.lookupBeans(FormElementProcessor.class);
processors.forEach(processorDef -> {
registerProcessor(processorDef.getInstance());
});
Collection<SyncBeanDef<FormGenerationResourcesProvider>> builderDefs = beanManager.lookupBeans(FormGenerationResourcesProvider.class);
builderDefs.forEach(builderDef -> {
FormGenerationResourcesProvider instance = builderDef.getInstance();
registerResources(instance);
beanManager.destroyBean(instance);
});
}
use of org.jboss.errai.ioc.client.container.SyncBeanDef in project kie-wb-common by kiegroup.
the class ClientBindableMorphAdapter method init.
@PostConstruct
@SuppressWarnings("unchecked")
public void init() {
// Morph definitions.
Collection<SyncBeanDef<MorphDefinitionProvider>> beanMorphAdapters = beanManager.lookupBeans(MorphDefinitionProvider.class);
for (SyncBeanDef<MorphDefinitionProvider> morphAdapter : beanMorphAdapters) {
MorphDefinitionProvider provider = morphAdapter.getInstance();
morphDefinitions.addAll(provider.getMorphDefinitions());
}
}
use of org.jboss.errai.ioc.client.container.SyncBeanDef in project kie-wb-common by kiegroup.
the class IconLocator method init.
@PostConstruct
public void init() {
// @Any doesn't work client side, so lookup instances using Errai's BeanManager
final Collection<SyncBeanDef<ClientResourceType>> availableResourceTypes = iocManager.lookupBeans(ClientResourceType.class);
for (final SyncBeanDef<ClientResourceType> resourceTypeBean : availableResourceTypes) {
final ClientResourceType resourceType = resourceTypeBean.getInstance();
resourceTypes.add(resourceType);
}
// Sort ResourceTypes so those with highest priority match first
Collections.sort(resourceTypes, new Comparator<ClientResourceType>() {
@Override
public int compare(final ClientResourceType o1, final ClientResourceType o2) {
int priority1 = o1.getPriority();
int priority2 = o2.getPriority();
if (priority1 == priority2) {
return 0;
}
if (priority1 < priority2) {
return 1;
}
return -1;
}
});
}
Aggregations