Search in sources :

Example 6 with SyncBeanDef

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);
    });
}
Also used : FormGenerationResourcesProvider(org.kie.workbench.common.forms.adf.service.building.FormGenerationResourcesProvider) SyncBeanManager(org.jboss.errai.ioc.client.container.SyncBeanManager) SyncBeanDef(org.jboss.errai.ioc.client.container.SyncBeanDef) PostConstruct(javax.annotation.PostConstruct)

Example 7 with SyncBeanDef

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());
    }
}
Also used : MorphDefinitionProvider(org.kie.workbench.common.stunner.core.definition.morph.MorphDefinitionProvider) SyncBeanDef(org.jboss.errai.ioc.client.container.SyncBeanDef) PostConstruct(javax.annotation.PostConstruct)

Example 8 with SyncBeanDef

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;
        }
    });
}
Also used : ClientResourceType(org.uberfire.client.workbench.type.ClientResourceType) SyncBeanDef(org.jboss.errai.ioc.client.container.SyncBeanDef) PostConstruct(javax.annotation.PostConstruct)

Aggregations

SyncBeanDef (org.jboss.errai.ioc.client.container.SyncBeanDef)8 PostConstruct (javax.annotation.PostConstruct)6 ClientResourceType (org.uberfire.client.workbench.type.ClientResourceType)2 SyncBeanManager (org.jboss.errai.ioc.client.container.SyncBeanManager)1 FormGenerationResourcesProvider (org.kie.workbench.common.forms.adf.service.building.FormGenerationResourcesProvider)1 FieldDefinition (org.kie.workbench.common.forms.model.FieldDefinition)1 DefinitionSetProxy (org.kie.workbench.common.stunner.core.definition.DefinitionSetProxy)1 DefinitionAdapter (org.kie.workbench.common.stunner.core.definition.adapter.DefinitionAdapter)1 DefinitionSetAdapter (org.kie.workbench.common.stunner.core.definition.adapter.DefinitionSetAdapter)1 DefinitionSetRuleAdapter (org.kie.workbench.common.stunner.core.definition.adapter.DefinitionSetRuleAdapter)1 MorphAdapter (org.kie.workbench.common.stunner.core.definition.adapter.MorphAdapter)1 PropertyAdapter (org.kie.workbench.common.stunner.core.definition.adapter.PropertyAdapter)1 PropertySetAdapter (org.kie.workbench.common.stunner.core.definition.adapter.PropertySetAdapter)1 MorphDefinitionProvider (org.kie.workbench.common.stunner.core.definition.morph.MorphDefinitionProvider)1 LayoutDragComponent (org.uberfire.ext.layout.editor.client.api.LayoutDragComponent)1 Command (org.uberfire.mvp.Command)1 MenuItem (org.uberfire.workbench.model.menu.MenuItem)1