java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.inductiveautomation.ignition.designer.tabbedworkspace.ResourceEditor<T>
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
FallbackReadOnlyEditor, NamedQueryResourceEditor, ReportingResourceEditor, StylesheetResourceEditor, ViewResourceEditor

public abstract class ResourceEditor<T> extends JPanel
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • isOptimizeCommits

      protected boolean isOptimizeCommits()
      Override this and return true if you want commits to use equality on the resource objects to avoid un-necessary commits.
    • createLogger

      protected LoggerEx createLogger()
    • loadResource

      protected void loadResource(ProjectResource resource)
    • updateResource

      public void updateResource(ProjectResource resource)
      Call this when the resource changes due to project pulls
    • init

      protected abstract void init(T object)
    • getResourcePath

      public ResourcePath getResourcePath()
    • getResource

      protected T getResource()
    • getTabTitle

      public String getTabTitle()
    • getObjectForSave

      protected abstract T getObjectForSave() throws Exception
      Return the object that should be saved to represent this resource in the ProjectResource. Will be serialized using an XMLSerializer. Override save() to serialize in a different manner.
      Throws:
      Exception
    • deserialize

      protected T deserialize(ProjectResource resource) throws Exception
      Deserialize a project resource into the editing object type for this editor. Default implementation simply calls this.deserialize(resource.getData()). Override this method if your resource does not use the default data.bin file.
      Throws:
      Exception
    • deserialize

      protected T deserialize(byte[] bytes) throws Exception
      Deserialize the byte[] inside of the project resource's data.bin file into the editing object type for this editor.

      Default implementation uses an XMLDeserializer to deserialize the byte[]. If you serialize your object differently, override this method.

      If you store your project resource in a different file or set of files, override deserialize(ProjectResource) instead.

      Throws:
      Exception
    • serialize

      protected byte[] serialize(T o) throws Exception
      Serializes the object using an XMLSerializer. If you want to serialize your object into a data.bin using a different encoding override this method.

      If you want to serialize your object into a different file or multiple files, override serializeResource(ProjectResourceBuilder, Object) instead.

      Throws:
      Exception
    • serializeResource

      protected void serializeResource(ProjectResourceBuilder builder, T object) throws Exception
      Serialize the object and put the serialized file(s) and attribute(s) into the project resource builder. Default implementation is:
      builder.putData(serialize(object));
      Implementations don't need to bother setting the project's resourcePath, projectName, or applicationScope; those will be set automatically.
      Throws:
      Exception
    • commit

      public void commit()
      Called when it's time to commit the resource being edited. Default implementation uses XML serialization. If you override, don't forget to call workspace.project().updateLock
    • onCommitFailed

      protected void onCommitFailed(Exception ex)