use of org.talend.designer.components.exchange.ui.htmlcontent.ExchangeContentProvider in project tdi-studio-se by Talend.
the class ExchangeManager method resolveDynamicContent.
/**
*
* DOC talend Comment method "resolveDynamicContent".
*
* @param dom
* @param nodes original contentProvider nods parsed from html file
* @return
*/
private Document resolveDynamicContent(Document dom, Node[] nodes) {
for (int i = 0; i < nodes.length; i++) {
Element contentProviderElement = (Element) nodes[i];
IntroContentProvider provider = new IntroContentProvider(contentProviderElement, ExchangePlugin.getDefault().getBundle());
IIntroXHTMLContentProvider providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().getContentProvider(provider);
if (providerClass == null)
providerClass = (IIntroXHTMLContentProvider) ContentProviderManager.getInst().createContentProvider(provider, null);
if (providerClass != null) {
if (providerClass instanceof ExchangeContentProvider) {
if (getSelectedExtension() != null) {
((ExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
} else {
((ExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
}
} else if (providerClass instanceof AvailableCompositeProvider) {
if (getAvialableFilter() == null) {
((AvailableCompositeProvider) providerClass).setfAvailableExtensions(fAvailableExtensions);
} else {
List<ComponentExtension> fAvailableExtensionsFilter = new ArrayList<ComponentExtension>();
for (ComponentExtension Extension : fAvailableExtensions) {
if (Extension.getLabel().toUpperCase().contains(getAvialableFilter().toUpperCase())) {
fAvailableExtensionsFilter.add(Extension);
}
}
((AvailableCompositeProvider) providerClass).setfAvailableExtensions(fAvailableExtensionsFilter);
}
} else if (providerClass instanceof DownloadExtensionProvider) {
loadDownloadedExtensionsFromFile();
((DownloadExtensionProvider) providerClass).setfInstalledExtensions(fInstalledExtensions);
((DownloadExtensionProvider) providerClass).setfDownloadedExtensions(fDownloadedExtensions);
} else if (providerClass instanceof MyExchangeContentProvider) {
((MyExchangeContentProvider) providerClass).setComponentExtension(getSelectedExtension());
((MyExchangeContentProvider) providerClass).setfContributeExtensions(new ArrayList<ComponentExtension>(fContributedExtensions));
}
// revert the content contentprovider before generate the dynamic content
reinjectDynamicContent(dom, contentProviderElement);
Properties att = new Properties();
att.setProperty(IIntroHTMLConstants.ATTRIBUTE_ID, provider.getId());
// Element contentDiv = ModelUtil.createElement(dom, ModelUtil.TAG_DIV, att);
Element contentDiv = TalendHtmlModelUtil.createElement(dom, TalendHtmlModelUtil.TAG_DIV, att);
providerClass.createContent(provider.getId(), contentDiv);
contentProviderElement.getParentNode().replaceChild(contentDiv, contentProviderElement);
} else {
// we couldn't load the content provider, so add any alternate
// text content if there is any.
// INTRO: do it. 3.0 intro content style uses text element as
// alt text. We can load XHTML content here.
}
}
return dom;
}
Aggregations