Class ComponentDescriptorImpl
- java.lang.Object
-
- com.inductiveautomation.perspective.common.api.ComponentDescriptorImpl
-
- All Implemented Interfaces:
ComponentDescriptor
public class ComponentDescriptorImpl extends java.lang.Object implements ComponentDescriptor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classComponentDescriptorImpl.ComponentBuilder
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<BrowserResource>browserResources()Returns a set ofBrowserResources, which are provided to the designer and perspective client at runtime to insure the needed items are provided in the web environment to support the component.java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonObject>childPositionDefaults()Defined default position property structure and values for children of new instances of this component.JsonSchemachildPositionSchema()Used for components that are containers in order to provide a schema for the position objects of their children.java.lang.StringdefaultMetaName()The default meta.name value for this component.com.inductiveautomation.ignition.common.gson.JsonObjectdefaultProperties()Defines default property structure and values for new instances of this component.booleandeprecated()java.util.Collection<ComponentEventDescriptor>events()java.util.Collection<ExtensionFunctionDescriptor>extensionFunctions()static ComponentDescriptorImpl.ComponentBuilderfromJson(com.inductiveautomation.ignition.common.gson.JsonObject json, java.lang.String moduleId, java.lang.String versionHash)Builds a ComponentDescriptor, given aJsonObjectthat is follows the following format:static ComponentDescriptorImpl.ComponentBuilderfromJson(com.inductiveautomation.ignition.common.gson.JsonObject json, java.lang.String moduleId, java.util.function.Function<java.lang.String,javax.swing.Icon> iconFetcher, java.util.function.BiFunction<java.lang.String,java.lang.String,java.awt.image.BufferedImage> thumbnailFetcher, java.lang.String versionHash)Use this variant if you know how to provide icons and thumbnails for your components.java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonObject>getExampleChildPositionDefaults()java.util.Optional<javax.swing.Icon>getIcon()Return the icon that is registered along with the descriptor.java.lang.Stringid()The unique string that identifies this componentjava.lang.StringmoduleId()The moduleId should be a String id that matches the module that is contributing this component to the Ignition Perspective module system.java.lang.Stringname()@NotNull java.lang.StringpaletteCategory()Which category this component should be listed under in the Designer's component palette.@NotNull java.util.Collection<PaletteEntry>paletteEntries()JsonSchemaschema()Defines the shape of the component's properties structure.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.inductiveautomation.perspective.common.api.ComponentDescriptor
getInitialProps
-
-
-
-
Method Detail
-
moduleId
@Nonnull public java.lang.String moduleId()
Description copied from interface:ComponentDescriptorThe moduleId should be a String id that matches the module that is contributing this component to the Ignition Perspective module system.- Specified by:
moduleIdin interfaceComponentDescriptor- Returns:
- the Ignition module ID of the module providing the component.
-
defaultMetaName
@Nonnull public java.lang.String defaultMetaName()
Description copied from interface:ComponentDescriptorThe default meta.name value for this component.- Specified by:
defaultMetaNamein interfaceComponentDescriptor
-
name
public java.lang.String name()
- Specified by:
namein interfaceComponentDescriptor- Returns:
- a human-readable name to briefly describe the component
-
deprecated
public boolean deprecated()
- Specified by:
deprecatedin interfaceComponentDescriptor- Returns:
- true if this component is no longer in active use. This will hide it from the palette and other UI that allows users to pick components (e.g. tag drop config)
-
paletteCategory
@NotNull public @NotNull java.lang.String paletteCategory()
Description copied from interface:ComponentDescriptorWhich category this component should be listed under in the Designer's component palette.- Specified by:
paletteCategoryin interfaceComponentDescriptor
-
paletteEntries
@NotNull public @NotNull java.util.Collection<PaletteEntry> paletteEntries()
- Specified by:
paletteEntriesin interfaceComponentDescriptor
-
defaultProperties
@Nonnull public com.inductiveautomation.ignition.common.gson.JsonObject defaultProperties()
Description copied from interface:ComponentDescriptorDefines default property structure and values for new instances of this component.- Specified by:
defaultPropertiesin interfaceComponentDescriptor
-
childPositionDefaults
public java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonObject> childPositionDefaults()
Description copied from interface:ComponentDescriptorDefined default position property structure and values for children of new instances of this component.- Specified by:
childPositionDefaultsin interfaceComponentDescriptor
-
browserResources
@Nonnull public java.util.Set<BrowserResource> browserResources()
Description copied from interface:ComponentDescriptorReturns a set ofBrowserResources, which are provided to the designer and perspective client at runtime to insure the needed items are provided in the web environment to support the component. Common use cases are css files and js libraries. These resources are collected at runtime and added to the DOM prior to starting the project/view.- Specified by:
browserResourcesin interfaceComponentDescriptor- Returns:
- a set of resources that the component requires.
-
schema
public JsonSchema schema()
Description copied from interface:ComponentDescriptorDefines the shape of the component's properties structure.- Specified by:
schemain interfaceComponentDescriptor
-
childPositionSchema
@Nullable public JsonSchema childPositionSchema()
Description copied from interface:ComponentDescriptorUsed for components that are containers in order to provide a schema for the position objects of their children.- Specified by:
childPositionSchemain interfaceComponentDescriptor
-
id
@Nonnull public java.lang.String id()
Description copied from interface:ComponentDescriptorThe unique string that identifies this component- Specified by:
idin interfaceComponentDescriptor
-
events
@Nonnull public java.util.Collection<ComponentEventDescriptor> events()
- Specified by:
eventsin interfaceComponentDescriptor- Returns:
- a collection of the events that this component might fire.
-
extensionFunctions
@Nonnull public java.util.Collection<ExtensionFunctionDescriptor> extensionFunctions()
- Specified by:
extensionFunctionsin interfaceComponentDescriptor- Returns:
- a collection of the extension functions that this component declares
-
getExampleChildPositionDefaults
public java.util.Optional<com.inductiveautomation.ignition.common.gson.JsonObject> getExampleChildPositionDefaults()
- Specified by:
getExampleChildPositionDefaultsin interfaceComponentDescriptor
-
getIcon
public java.util.Optional<javax.swing.Icon> getIcon()
Description copied from interface:ComponentDescriptorReturn the icon that is registered along with the descriptor. If an icon is not set, the default icon will be used instead.
Pro-tip: use
InteractiveSvgIconto create an icon that works well in the nav-tree- Specified by:
getIconin interfaceComponentDescriptor- Returns:
- icon used for the nav tree and component palette
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
fromJson
public static ComponentDescriptorImpl.ComponentBuilder fromJson(@Nonnull com.inductiveautomation.ignition.common.gson.JsonObject json, @Nonnull java.lang.String moduleId, @Nullable java.lang.String versionHash)
Builds a ComponentDescriptor, given aJsonObjectthat is follows the following format:{ "id": "mymodule.my-component", "name": "My Component", "deprecated": false, (optional), "defaultMetaName": "MyComp", "palette": { "category": "Examples", "variants": [ { "label": "My Component", "tooltip": "It's a useful component" }, { (additional entries optional) "id": "alt-1", "label": "My Component - Alternate", "tooltip": "It's like the normal version, but different" "props": { "someSetting": "set-differently" } } ] } "schema": { json-schema here } }- Parameters:
json- object to build the descriptor from- Returns:
- ComponentDescriptor populated from the given json object
- Since:
- Ignition 8.0.6
-
fromJson
public static ComponentDescriptorImpl.ComponentBuilder fromJson(@Nonnull com.inductiveautomation.ignition.common.gson.JsonObject json, @Nonnull java.lang.String moduleId, @Nonnull java.util.function.Function<java.lang.String,javax.swing.Icon> iconFetcher, @Nonnull java.util.function.BiFunction<java.lang.String,java.lang.String,java.awt.image.BufferedImage> thumbnailFetcher, @Nullable java.lang.String versionHash)
Use this variant if you know how to provide icons and thumbnails for your components.- Parameters:
iconFetcher- function of component id -> (nullable)iconthumbnailFetcher- function of (component id, variant id) -> (nullable)buffered image
-
-