Class OdfModel

java.lang.Object
schema2template.grammar.OdfModel

public class OdfModel extends Object
Model for ODF specific enhancements. Capsulates information from the from the config file. For example, these might be: - style families used for ODF elements - default value attribute
  • Constructor Details

  • Method Details

    • isStylable

      public boolean isStylable(PuzzleComponent element)
      Determine whether an ELEMENT is stylable (a.k.a. has at least one defined style family). Note: All Definitions sharing the same name share the same style families.
      Parameters:
      element - stylable element name
      Returns:
      whether there are style families defined for this Definition
    • isStylable

      public boolean isStylable(SourceCodeBaseClass base)
      Determines whether all subclasses of this JavaBaseClass are stylable or not stylable.
      Returns:
      whether all subclasses are stylable (true) or none (false).
      Throws:
      RuntimeException - if some subclasses are stylable and some are not
    • getStyleFamilies

      public List<String> getStyleFamilies(PuzzleComponent element)
      Get defined style families for this ELEMENT Definition. Note: All Definitions sharing the same name share the same style families.
      Parameters:
      element - Element
      Returns:
      list of style family names
    • getStyleFamilies

      public SortedSet<String> getStyleFamilies()
      Get all defined style family names
      Returns:
      SortedSet of Style Family Names
    • getDefaultAttributeValue

      public String getDefaultAttributeValue(String attributeName, String parentElementName)
      Get default value of ODF attribute, depending on the ODF element which contains this attribute.
      Parameters:
      attributeName - Attribute's qualified name
      parentElementName - Parent element's qualified name
      Returns:
      Default value for attribute of parent
    • getDefaultAttributeValues

      public Set<String> getDefaultAttributeValues(String attributeName)
      Get default values of ODF attribute.
      Parameters:
      attributeName - Attribute qualified name
      Returns:
      Default values for attribute
    • getStyleFamilyPropertiesMap

      public Map<String,List<String>> getStyleFamilyPropertiesMap()
      Get the relation between @style:family value and child property elements, which is being extracted with MSV from the grammar: For instance: <style:style style:family="paragraph"> <style:paragraph-properties /> <style:text-properties /> </style:style>
      Returns:
      the map showing the realtion between style:family attribute value as key and the style:*-properties element names as values.
    • isRootOfComponent

      public boolean isRootOfComponent(String qualifiedElementName)
      The name of all elements that are the beginning of a semantic user component, which is usually added/deleted by user aligned with the common user given name!
      Parameters:
      qualifiedElementName - the QName of the element
    • isRepetionAttribute

      public boolean isRepetionAttribute(String qualifiedAttributeName)
      Some attribute represents the number of repetition of its parent element. This method identifies those.
      Parameters:
      qualifiedAttributeName - the QName of the attribute
      Returns:
      true if the attribute represents the semantic of the repetition of its parent element!
    • getRepetionAttribute

      public PuzzlePiece getRepetionAttribute(String qualifiedElementName)
      Some attribute represents the number of repetition of its parent element. This method returns such an attribute for a given element.
      Parameters:
      qualifiedElementName - the QName of the element
      Returns:
      the attribute with the repetition function as PuzzlePiece