Search in sources :

Example 1 with WidgetRepresentationFactory

use of org.csstudio.display.builder.representation.WidgetRepresentationFactory in project org.csstudio.display.builder by kasemir.

the class JFXRepresentation method initialize.

@Override
protected void initialize() {
    final Map<String, WidgetRepresentationFactory<Parent, Node>> factories = new HashMap<>();
    registerKnownRepresentations(factories);
    final IExtensionRegistry registry = RegistryFactory.getRegistry();
    if (registry != null) {
        // which allows other plugins to contribute new widgets.
        for (IConfigurationElement config : registry.getConfigurationElementsFor(WidgetRepresentation.EXTENSION_POINT)) {
            final String type = config.getAttribute("type");
            final String clazz = config.getAttribute("class");
            logger.log(Level.CONFIG, "{0} contributes {1}", new Object[] { config.getContributor().getName(), clazz });
            factories.put(type, createFactory(config));
        }
    }
    for (Map.Entry<String, WidgetRepresentationFactory<Parent, Node>> entry : factories.entrySet()) register(entry.getKey(), entry.getValue());
    if (!initialized_colormaps) {
        for (PredefinedColorMaps.Predefined map : PredefinedColorMaps.PREDEFINED) NamedColorMappings.add(new NamedColorMapping(map.getName(), intensity -> ColorMappingFunction.getRGB(map.getColor(intensity))));
        initialized_colormaps = true;
    }
}
Also used : WidgetRepresentationFactory(org.csstudio.display.builder.representation.WidgetRepresentationFactory) HashMap(java.util.HashMap) PredefinedColorMaps(org.csstudio.display.builder.model.properties.PredefinedColorMaps) NamedColorMapping(org.csstudio.javafx.rtplot.NamedColorMapping) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement) Map(java.util.Map) HashMap(java.util.HashMap) IExtensionRegistry(org.eclipse.core.runtime.IExtensionRegistry)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 PredefinedColorMaps (org.csstudio.display.builder.model.properties.PredefinedColorMaps)1 WidgetRepresentationFactory (org.csstudio.display.builder.representation.WidgetRepresentationFactory)1 NamedColorMapping (org.csstudio.javafx.rtplot.NamedColorMapping)1 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)1 IExtensionRegistry (org.eclipse.core.runtime.IExtensionRegistry)1