Class RepeaterDefinition

All Implemented Interfaces:
Comparable<ModelItem>, ModelItem, ModelItemAccessor, ModelItemContainer, Labelable, ModifiableLabelable
Direct Known Subclasses:
ContentRestrictedRepeaterDefinition

public class RepeaterDefinition extends ModelItemGroup
Definition of a repeater.
  • Constructor Details

    • RepeaterDefinition

      Default constructor.
    • RepeaterDefinition

      public RepeaterDefinition(String name, ModelItemType type, ModelItem... children)
      Constructor used to create simple models and items
      Parameters:
      name - the name of the definition
      type - the type of the repeater
      children - the repeater's children
  • Method Details

    • getInitialSize

      public int getInitialSize()
      Retrieves the initial size.
      Returns:
      the initial size.
    • setInitialSize

      public void setInitialSize(int size)
      Set the initial size.
      Parameters:
      size - the initial size.
    • getMinSize

      public int getMinSize()
      Retrieves the minimum size.
      Returns:
      the minimum size.
    • setMinSize

      public void setMinSize(int size)
      Set the minimum size.
      Parameters:
      size - the minimum size.
    • getMaxSize

      public int getMaxSize()
      Retrieves the maximum size.
      Returns:
      the maximum size or -1 if unbounded.
    • setMaxSize

      public void setMaxSize(int size)
      Set the maximum size.
      Parameters:
      size - the maximum size or -1 if unbounded.
    • getAddLabel

      Retrieves the add label.
      Returns:
      the add label or null if none.
    • setAddLabel

      public void setAddLabel(I18nizableText label)
      Set the add label.
      Parameters:
      label - the add label or null if none.
    • getDeleteLabel

      Retrieves the delete label.
      Returns:
      the delete label or null if none.
    • setDeleteLabel

      public void setDeleteLabel(I18nizableText label)
      Set the delete label.
      Parameters:
      label - the delete label or null if none.
    • getHeaderLabel

      Get the header label.
      Returns:
      the header label or null if none.
    • setHeaderLabel

      public void setHeaderLabel(String label)
      Set the header label.
      Parameters:
      label - the header label or null if none.
    • _toJSON

      protected Map<String,Object> _toJSON(DefinitionContext context, boolean includeChildren) throws ProcessingException
      Description copied from class: ModelItemGroup
      Converts the model item group in a JSON map
      Overrides:
      _toJSON in class ModelItemGroup
      Parameters:
      context - the context of the definition
      includeChildren - true to iterate and add children as elements in the returned JSON map, false otherwise
      Returns:
      The model item as a JSON map
      Throws:
      ProcessingException - If an error occurs when converting the model item group
    • toSAX

      public void toSAX(ContentHandler contentHandler, DefinitionContext context) throws SAXException
      Description copied from class: ModelItemGroup
      Generates SAX events for the model item Do not generate SAX events for children. This method has been created to generate SAX events for views, the children are taken into account via view items children
      Specified by:
      toSAX in interface ModelItem
      Overrides:
      toSAX in class ModelItemGroup
      Parameters:
      contentHandler - the ContentHandler that will receive the SAX events
      context - the context of the definition
      Throws:
      SAXException - if an error occurs during the SAX events generation
    • of

      public static RepeaterDefinition of(String name, String availableTypesExtensionPoint, ModelItem... children) throws UnknownTypeException, ServiceException
      Parameters:
      name - the repeater's name
      availableTypesExtensionPoint - the role of the extension point containing all available types for this ModelItem
      children - the repeater's children
      Returns:
      the created RepeaterDefinition
      Throws:
      UnknownTypeException - if the repeater type is not available in the extension point
      ServiceException - if an error occurs while getting the extension point of available types