Class ComponentRegistry
- java.lang.Object
-
- com.inductiveautomation.perspective.common.api.ComponentRegistry
-
- Direct Known Subclasses:
DesignerComponentRegistry
public class ComponentRegistry extends java.lang.ObjectRegistry of all perspective components. Module authors should register their components here in both Gateway and Designer scopes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceComponentRegistry.ComponentRegistryListener
-
Constructor Summary
Constructors Constructor Description ComponentRegistry()ComponentRegistry(java.util.List<java.lang.String> defFileNames)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ComponentDescriptorbuildDescriptor(com.inductiveautomation.ignition.common.gson.JsonObject componentDef, java.lang.String versionHash)static java.awt.image.BufferedImagefetchImage(java.net.URL url)Fetches an image will be used for component palette tile entries in the designer.java.util.Optional<ComponentDescriptor>find(java.lang.String type)java.util.Map<java.lang.String,ComponentDescriptor>get()java.util.Set<java.lang.String>getCategories()voidregisterComponent(ComponentDescriptor comp)Registers a component with the Perspective ComponentRegistry.voidregisterListener(ComponentRegistry.ComponentRegistryListener listener)voidremoveComponent(java.lang.String componentId)Removes a component from the registry.voidremoveListener(ComponentRegistry.ComponentRegistryListener listener)
-
-
-
Method Detail
-
registerComponent
public void registerComponent(@Nonnull ComponentDescriptor comp)Registers a component with the Perspective ComponentRegistry.For a component to show up, it must
- Not be
deprecated - Have at least one palette varient
- Have a valid name
- Include any appropriate
BrowserResourceentries
Registering a new component will notify any registered
ComponentRegistry.ComponentRegistryListeners.- Parameters:
comp- the descriptor for the component
- Not be
-
removeComponent
public void removeComponent(@Nonnull java.lang.String componentId)Removes a component from the registry.Removing a component will notify any registered
ComponentRegistry.ComponentRegistryListeners.- Parameters:
componentId- theComponentDescriptor.id()value of the component to remove
-
get
public java.util.Map<java.lang.String,ComponentDescriptor> get()
-
find
public java.util.Optional<ComponentDescriptor> find(java.lang.String type)
-
getCategories
public java.util.Set<java.lang.String> getCategories()
-
buildDescriptor
protected ComponentDescriptor buildDescriptor(com.inductiveautomation.ignition.common.gson.JsonObject componentDef, @Nullable java.lang.String versionHash)
-
registerListener
public void registerListener(ComponentRegistry.ComponentRegistryListener listener)
-
removeListener
public void removeListener(ComponentRegistry.ComponentRegistryListener listener)
-
fetchImage
@Nullable public static java.awt.image.BufferedImage fetchImage(java.net.URL url)
Fetches an image will be used for component palette tile entries in the designer. The image will be scaled down to 72x48.- Parameters:
url- URL for the image- Returns:
- a buffered image or null if the URL is not valid
-
-