Class ComponentDescriptorImpl

java.lang.Object
com.inductiveautomation.perspective.common.api.ComponentDescriptorImpl
All Implemented Interfaces:
ComponentDescriptor

public class ComponentDescriptorImpl extends Object implements ComponentDescriptor
  • Method Details

    • moduleId

      @Nonnull public String moduleId()
      Description copied from interface: ComponentDescriptor
      The moduleId should be a String id that matches the module that is contributing this component to the Ignition Perspective module system.
      Specified by:
      moduleId in interface ComponentDescriptor
      Returns:
      the Ignition module ID of the module providing the component.
    • defaultMetaName

      @Nonnull public String defaultMetaName()
      Description copied from interface: ComponentDescriptor
      The default meta.name value for this component.
      Specified by:
      defaultMetaName in interface ComponentDescriptor
    • name

      public String name()
      Specified by:
      name in interface ComponentDescriptor
      Returns:
      a human-readable name to briefly describe the component
    • deprecated

      public boolean deprecated()
      Specified by:
      deprecated in interface ComponentDescriptor
      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 String paletteCategory()
      Description copied from interface: ComponentDescriptor
      Which category this component should be listed under in the Designer's component palette.
      Specified by:
      paletteCategory in interface ComponentDescriptor
    • paletteEntries

      @NotNull public Collection<PaletteEntry> paletteEntries()
      Specified by:
      paletteEntries in interface ComponentDescriptor
    • defaultProperties

      @Nonnull public com.inductiveautomation.ignition.common.gson.JsonObject defaultProperties()
      Description copied from interface: ComponentDescriptor
      Defines default property structure and values for new instances of this component.
      Specified by:
      defaultProperties in interface ComponentDescriptor
    • childPositionDefaults

      public Optional<com.inductiveautomation.ignition.common.gson.JsonObject> childPositionDefaults()
      Description copied from interface: ComponentDescriptor
      Defined default position property structure and values for children of new instances of this component.
      Specified by:
      childPositionDefaults in interface ComponentDescriptor
    • browserResources

      @Nonnull public Set<BrowserResource> browserResources()
      Description copied from interface: ComponentDescriptor
      Returns a set of BrowserResources, 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:
      browserResources in interface ComponentDescriptor
      Returns:
      a set of resources that the component requires.
    • schema

      public JsonSchema schema()
      Description copied from interface: ComponentDescriptor
      Defines the shape of the component's properties structure.
      Specified by:
      schema in interface ComponentDescriptor
    • childPositionSchema

      @Nullable public JsonSchema childPositionSchema()
      Description copied from interface: ComponentDescriptor
      Used for components that are containers in order to provide a schema for the position objects of their children.
      Specified by:
      childPositionSchema in interface ComponentDescriptor
    • id

      @Nonnull public String id()
      Description copied from interface: ComponentDescriptor
      The unique string that identifies this component
      Specified by:
      id in interface ComponentDescriptor
    • events

      @Nonnull public Collection<ComponentEventDescriptor> events()
      Specified by:
      events in interface ComponentDescriptor
      Returns:
      a collection of the events that this component might fire.
    • extensionFunctions

      @Nonnull public Collection<ExtensionFunctionDescriptor> extensionFunctions()
      Specified by:
      extensionFunctions in interface ComponentDescriptor
      Returns:
      a collection of the extension functions that this component declares
    • getExampleChildPositionDefaults

      public Optional<com.inductiveautomation.ignition.common.gson.JsonObject> getExampleChildPositionDefaults()
      Specified by:
      getExampleChildPositionDefaults in interface ComponentDescriptor
    • getIcon

      public Optional<Icon> getIcon()
      Description copied from interface: ComponentDescriptor

      Return 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 InteractiveSvgIcon to create an icon that works well in the nav-tree

      Specified by:
      getIcon in interface ComponentDescriptor
      Returns:
      icon used for the nav tree and component palette
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromJson

      public static ComponentDescriptorImpl.ComponentBuilder fromJson(@Nonnull com.inductiveautomation.ignition.common.gson.JsonObject json, @Nonnull String moduleId, @Nullable String versionHash)
      Builds a ComponentDescriptor, given a JsonObject that 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 String moduleId, @Nonnull Function<String,Icon> iconFetcher, @Nonnull BiFunction<String,String,BufferedImage> thumbnailFetcher, @Nullable String versionHash)
      Use this variant if you know how to provide icons and thumbnails for your components.
      Parameters:
      iconFetcher - function of component id -> (nullable)icon
      thumbnailFetcher - function of (component id, variant id) -> (nullable)buffered image