/** * Return the components extension both by resolving the property of the current * project and from the commons extension. If it is available instead of * request the extension from the superclass it search it in the common * cache * * @return a not null components extension */ @SuppressWarnings("unchecked") private List<ComponentsBundle> getExtensionComponents(){ if (bundles == null || refreshBundles) { bundles = (List<ComponentsBundle>)ExtensionLoader.getSharedExtension(ComponentsBundle.class); //fallback if something in the cache goes wrong if (bundles == null) bundles = super.getExtensions(ComponentsBundle.class); // remove all duplicates Set<ComponentsBundle> components = new LinkedHashSet<ComponentsBundle>(bundles); bundles = new ArrayList<ComponentsBundle>(components); for (ComponentsBundle cb : bundles) { try { ComponentManager cm = cb.getComponentManager(ComponentsExtensionsRegistryFactory.MAP_COMPONENT_NAME); if (cm != null && cm instanceof ComponentsManager) ((ComponentsManager) cm).setDesignConverter(MapDesignConverter.getInstance()); } catch (Exception e) { } } refreshBundles = false; } return bundles; }
public JRBaseComponentElement(JRComponentElement element, JRBaseObjectFactory factory) { super(element, factory); componentKey = element.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getManager(componentKey); component = manager.getComponentCompiler(DefaultJasperReportsContext.getInstance()).toCompiledComponent( element.getComponent(), factory); }
@Override public JRPrintElement convert(ReportConverter reportConverter, JRElement element) { JRComponentElement componentElement = (JRComponentElement) element; JRPrintElement converted = null; ComponentKey componentKey = componentElement.getComponentKey(); if (componentKey != null) { ComponentManager manager = reportConverter.getComponentsEnvironment().getManager(componentKey); if (manager != null) { ComponentDesignConverter converter = manager.getDesignConverter(reportConverter.getJasperReportsContext()); if (converter != null) { // convert using the component converter converted = converter.convert(reportConverter, componentElement); } } } if (converted == null) { // fallback to the icon converter converted = ICON_CONVERTER.convert(reportConverter, element); } return converted; }
public JRFillComponentElement(JRBaseFiller filler, JRComponentElement element, JRFillObjectFactory factory) { super(filler, element, factory); ComponentKey componentKey = element.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(filler.getJasperReportsContext()).getManager(componentKey); factory.trackDatasetRuns(); fillComponent = manager.getComponentFillFactory(filler.getJasperReportsContext()).toFillComponent(element.getComponent(), factory); fillComponent.initialize(this); this.componentDatasetRuns = factory.getTrackedDatasetRuns(); }
public JRFillComponentElement(JRFillComponentElement element, JRFillCloneFactory factory) { super(element, factory); ComponentKey componentKey = element.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(filler.getJasperReportsContext()).getManager(componentKey); fillComponent = manager.getComponentFillFactory(filler.getJasperReportsContext()).cloneFillComponent(element.fillComponent, factory); fillComponent.initialize(this); }
@Override public void collectExpressions(JRExpressionCollector collector) { ComponentManager manager = ComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getManager(componentKey); manager.getComponentCompiler(DefaultJasperReportsContext.getInstance()).collectExpressions(component, collector); }
/** * Collects expressions from a component element wrapper. * * <p> * Common element expressions are collected, and then the component * compiler's * {@link ComponentCompiler#collectExpressions(Component, JRExpressionCollector)} * is called to collect component expressions. * * @param componentElement the component element */ public void collect(JRComponentElement componentElement) { collectElement(componentElement); ComponentKey componentKey = componentElement.getComponentKey(); ComponentManager manager = ComponentsEnvironment.getInstance(jasperReportsContext).getManager(componentKey); Component component = componentElement.getComponent(); manager.getComponentCompiler(jasperReportsContext).collectExpressions(component, this); }