Class ClientFormTheme

All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IEntity<Long>, de.xima.cmn.dao.interfaces.ILockableEntity<Long>, ICustomAttributeProviding, ICustomAttributesEntity, IDescriptionProviding, IFileListProviding<ClientFormThemeFile, ClientFormThemeFileData>, ILockingVersionProviding, IMandantDependent, INameHolding, INameProviding, ITransferable, ITransferableEntity, ITransferableLockableEntity, IUUIDEntity, Serializable, Comparable<de.xima.cmn.dao.interfaces.IEntity<Long>>

Entity model for a form theme. A form theme is a collection of text and binary resources that are used to style a form, such as JavaScript files, CSS flies, fonts, and images. Users can select a form theme in the form designer; each form can have a different form theme. The form theme affects both the main web form and related pages such as HTML templates.
Since:
8.3.0
Author:
XIMA MEDIA GmbH
See Also:
  • Field Details

  • Constructor Details

    • ClientFormTheme

      public ClientFormTheme()
  • Method Details

    • addOrReplaceFile

      public ClientFormThemeFile addOrReplaceFile(String resourceContext, String fileName, byte[] data, IUser user)
      Adds a file with the given context and file name to this theme. When a file with the context and file name exists already, overrides the data of that file.
      Parameters:
      resourceContext - The resource context the file is used in, see EFormThemeResourceContext for well-known contexts. See also getResourceContext().
      fileName - The name of the file. The file name must be unique among all files with the same context.
      data - The data of the file.
      user - The user who adds the file. May be null for the anonymous user.
      Returns:
      The file that was added or replaced.
    • cloneBasics

      public ClientFormTheme cloneBasics()
      Creates a copy of this client form theme, with all basic field (i.e. without referenced entities) copied.
      Returns:
      A copy of this client form theme.
    • getBeschreibung

      @Deprecated public String getBeschreibung()
      Deprecated.
      Use getDescription() instead.
      Gets the internal description of this form theme. The description is only visible in the backend when editing the theme.
      Specified by:
      getBeschreibung in interface IDescriptionProviding
      Returns:
      The internal description of this form theme.
    • getClient

      public Mandant getClient()
      Gets the client scope to which this form theme belongs.
      Returns:
      client This theme's client scope.
    • setClient

      public void setClient(Mandant client)
      The client scope to which this form theme belongs.
      Parameters:
      client - This theme's client scope.
    • getCustomAttributes

      public Map<String,String> getCustomAttributes()
      Gets the custom attributes that may be used to store additional information.
      Specified by:
      getCustomAttributes in interface ICustomAttributeProviding
      Returns:
      The custom attributes.
    • setCustomAttributes

      public void setCustomAttributes(Map<String,String> customAttributes)
      Sets the custom attributes that may be used to store additional information.
      Specified by:
      setCustomAttributes in interface ICustomAttributesEntity
      Parameters:
      customAttributes - The custom attributes to set.
    • getDescription

      public String getDescription()
      Gets the internal description of this form theme. The description is only visible in the backend when editing the theme.
      Specified by:
      getDescription in interface IDescriptionProviding
      Returns:
      The internal description of this form theme.
    • setDescription

      public void setDescription(String description)
      Sets the internal description of this form theme. The description is only visible in the backend when editing the theme.
      Parameters:
      description - The internal description of this form theme.
    • getFile

      public ClientFormThemeFile getFile(String resourceContext, String fileName)
      Gets a file with the given file name from the given context, if such a file exists.
      Parameters:
      resourceContext - The resource context the file is used in, see EFormThemeResourceContext for well-known contexts. See also getResourceContext().
      fileName - The name of the file. The file name must be unique among all files with the same context.
      Returns:
      The file with the given context and file name, or null if no such file exists.
    • getFileData

      public byte[] getFileData(String resourceContext, String fileName)
      Gets the binary content of the given file. When the file does not exist, returns null.
      Parameters:
      resourceContext - The resource context the file is used in, see EFormThemeResourceContext for well-known contexts. See also getResourceContext().
      fileName - The name of the file. The file name must be unique among all files with the same context.
      Returns:
      The binary content of the file, or null if the file does not exist.
    • getFiles

      public List<ClientFormThemeFile> getFiles()
      Gets the list of files that are used by this form theme. This includes plain text resources such as JavaScript and CSS files, as well as binary resources such as images and fonts. Unless the order is determined in some other way, resources such as CSS and JavaScript files are inserted in the order of their file name. The file name must be unique among all files in the same form theme.
      Specified by:
      getFiles in interface IFileListProviding<ClientFormThemeFile, ClientFormThemeFileData>
      Returns:
      The list of files used by this form theme.
    • setFiles

      public void setFiles(List<ClientFormThemeFile> files)
      Sets the list of files that are used by this form theme. This includes plain text resources such as JavaScript and CSS files, as well as binary resources such as images and fonts. Unless the order is determined in some other way, resources such as CSS and JavaScript files are inserted in the order of their file name. The file name must be unique among all files in the same form theme.
      Specified by:
      setFiles in interface IFileListProviding<ClientFormThemeFile, ClientFormThemeFileData>
      Parameters:
      files - The list of files used by this form theme.
    • getFilesMapFlat

      Creates a new, modifiable map that represents a snapshot of the current files. The map key is the ID of the ClientFormThemeFile, the map value the file itself.
      Returns:
      A new map with all files.
    • getFilesMapNested

      public Map<String, Map<String, ClientFormThemeFile>> getFilesMapNested()
      Creates a new, modifiable map that represents a snapshot of the current files. The map key is the resource context, the map value another map with the file path as the key and the file itself as the value.
      Returns:
      A new map with all files.
    • getId

      public Long getId()
      Gets the database ID of this form theme. The database ID is unique within the system, across all clients.
      Specified by:
      getId in interface de.xima.cmn.dao.interfaces.IEntity<Long>
      Returns:
      The database ID of this form theme.
    • setId

      public void setId(Long id)
      Sets the database ID of this form theme. The database ID is unique within the system, across all clients. Note: Since the ID is generated by the database, this method should normally not be used.
      Specified by:
      setId in interface de.xima.cmn.dao.interfaces.IEntity<Long>
      Overrides:
      setId in class AbstractEntity
      Parameters:
      id - The database ID of this form theme.
    • getMandant

      @Deprecated public Mandant getMandant()
      Deprecated.
      Use getClient() instead.
      Gets the client scope to which this form theme belongs.
      Specified by:
      getMandant in interface IMandantDependent
      Returns:
      client This theme's client scope.
    • setMandant

      @Deprecated public void setMandant(Mandant client)
      Deprecated.
      Use setClient(Mandant) instead.
      The client scope to which this form theme belongs.
      Specified by:
      setMandant in interface IMandantDependent
      Parameters:
      client - This theme's client scope.
    • getName

      public String getName()
      The name of this form theme. The name is displayed in the form designer and can be edited in the backend.
      Specified by:
      getName in interface INameProviding
      Returns:
      The new name of this form theme.
    • setName

      public void setName(String name)
      The name of this form theme. The name is displayed in the form designer and can be edited in the backend.
      Specified by:
      setName in interface INameHolding
      Parameters:
      name - The new name of this form theme.
    • getParentFormTheme

      public FormThemeReference getParentFormTheme()
      Gets the parent theme from which this theme inherits. If this theme has no parent, it is a top-level theme. Otherwise, the parent theme's CSS and JavaScript files are included first, before this theme. A parent may itself have a parent.
      Returns:
      The parent theme from which this theme inherits. May be null.
    • setParentFormTheme

      public void setParentFormTheme(FormThemeReference parentFormTheme)
      Sets the parent theme from which this theme inherits. If this theme has no parent, it is a top-level theme. Otherwise, the parent theme's CSS and JavaScript files are included first, before this theme. A parent may itself have a parent.
      Parameters:
      parentFormTheme - The parent theme from which this theme inherits. May be null.
    • getUUID

      public String getUUID()
      Gets the UUID of this entity as a string. The UUID is unique amongst all form themes belonging to the same client.
      Specified by:
      getUUID in interface IUUIDEntity
      Returns:
      uuid The UUID of the entity.
    • setUUID

      public void setUUID(String uuid)
      Sets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.
      Specified by:
      setUUID in interface IUUIDEntity
      Parameters:
      uuid - The UUID of the entity. Must be a valid UUID-4 string.
      Throws:
      IllegalArgumentException - If the UUID is non-empty and not a valid UUID-4 string.
    • getUUIDObject

      public UUID getUUIDObject()
      Gets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.
      Specified by:
      getUUIDObject in interface IUUIDEntity
      Returns:
      uuid The UUID of the entity.
    • setUUIDObject

      public void setUUIDObject(UUID uuid)
      Sets the UUID of this entity. The UUID is unique amongst all form themes belonging to the same client.
      Parameters:
      uuid - The UUID of the entity. Must be a valid UUID-4 string.
    • hasFile

      public boolean hasFile(String resourceContext, String fileName)
      Checks whether a file with the given file name from the given context exists.
      Parameters:
      resourceContext - The resource context the file is used in, see EFormThemeResourceContext for well-known contexts. See also getResourceContext().
      fileName - The name of the file. The file name must be unique among all files with the same context.
      Returns:
      True if a file with the given file name from the given context exists, false otherwise.
    • removeFile

      public void removeFile(String resourceContext, String fileName)
      Remove a file with the given file name from the given context, if such a file exists. Does nothing if no such file exists.
      Parameters:
      resourceContext - The resource context the file is used in, see EFormThemeResourceContext for well-known contexts. See also getResourceContext().
      fileName - The name of the file. The file name must be unique among all files with the same context.