Class JSResourceSet

java.lang.Object
com.helger.photon.app.html.JSResourceSet
All Implemented Interfaces:
com.helger.commons.collection.impl.ICommonsIterable<com.helger.html.resource.js.IJSPathProvider>, IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>, Iterable<com.helger.html.resource.js.IJSPathProvider>

@ThreadSafe public class JSResourceSet extends Object implements IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
This class keeps track of all the JS files that must be included for a single request, so that the controls are working properly.
Author:
Philip Helger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    JSResourceSet(com.helger.html.resource.js.IJSPathProvider... aOther)
     
     
    JSResourceSet(Collection<? extends com.helger.html.resource.js.IJSPathProvider> aOther)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.helger.commons.state.EChange
    addItem(int nIndex, com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
    Add an item at the specified index
    com.helger.commons.state.EChange
    addItem(com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
    Add an item
    com.helger.commons.state.EChange
    addItems(int nIndex, IWebResourceSet<? extends com.helger.html.resource.js.IJSPathProvider> aItems)
    Add all items from another list at the specified index.
    com.helger.commons.state.EChange
    addItems(IWebResourceSet<? extends com.helger.html.resource.js.IJSPathProvider> aItems)
    Add all items from another list.
    boolean
     
    com.helger.commons.collection.impl.ICommonsOrderedSet<com.helger.html.resource.js.IJSPathProvider>
     
    void
    getAllItems(Collection<? super com.helger.html.resource.js.IJSPathProvider> aTarget)
    Add all items to the provided target container.
    int
     
    int
     
    boolean
     
    boolean
     
    boolean
     
    Iterator<com.helger.html.resource.js.IJSPathProvider>
     
    void
    Call this method to mark the resource set as "collected for further processing".
    com.helger.commons.state.EChange
    Remove all items.
    com.helger.commons.state.EChange
    removeItem(com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
    Unregister an existing item
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.helger.commons.collection.impl.ICommonsIterable

    containsAny, containsNone, containsOnly, findAll, findAllInstanceOf, findAllMapped, findAllMapped, findAllMapped, findFirst, findFirst, findFirstIndex, findFirstMapped, findFirstMapped, findLastIndex, forEachBreakable, forEachByIndex, forEachThrowing, getCount

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Constructor Details

    • JSResourceSet

      public JSResourceSet()
    • JSResourceSet

      public JSResourceSet(@Nonnull JSResourceSet aOther)
    • JSResourceSet

      public JSResourceSet(@Nonnull Collection<? extends com.helger.html.resource.js.IJSPathProvider> aOther)
    • JSResourceSet

      public JSResourceSet(@Nonnull com.helger.html.resource.js.IJSPathProvider... aOther)
  • Method Details

    • addItem

      @Nonnull public com.helger.commons.state.EChange addItem(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Description copied from interface: IWebResourceSet
      Add an item
      Specified by:
      addItem in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      aJSPathProvider - The item to add. May not be null.
      Returns:
      EChange
    • addItem

      @Nonnull public com.helger.commons.state.EChange addItem(int nIndex, @Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Description copied from interface: IWebResourceSet
      Add an item at the specified index
      Specified by:
      addItem in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      nIndex - The index to be used. If the value is < 0 the value is ignored and item is appended.
      aJSPathProvider - The item to add. May not be null.
      Returns:
      EChange
    • addItems

      @Nonnull public com.helger.commons.state.EChange addItems(@Nonnull IWebResourceSet<? extends com.helger.html.resource.js.IJSPathProvider> aItems)
      Description copied from interface: IWebResourceSet
      Add all items from another list.
      Specified by:
      addItems in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      aItems - The items to be added. May not be null.
      Returns:
      EChange
    • addItems

      @Nonnull public com.helger.commons.state.EChange addItems(int nIndex, @Nonnull IWebResourceSet<? extends com.helger.html.resource.js.IJSPathProvider> aItems)
      Description copied from interface: IWebResourceSet
      Add all items from another list at the specified index.
      Specified by:
      addItems in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      nIndex - The index to be used. If the value is < 0 the value is ignored and item is appended.
      aItems - The items to be added. May not be null.
      Returns:
      EChange
    • removeItem

      @Nonnull public com.helger.commons.state.EChange removeItem(@Nonnull com.helger.html.resource.js.IJSPathProvider aJSPathProvider)
      Description copied from interface: IWebResourceSet
      Unregister an existing item
      Specified by:
      removeItem in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      aJSPathProvider - The item to be removed. May not be null.
      Returns:
      EChange
    • removeAll

      @Nonnull public com.helger.commons.state.EChange removeAll()
      Description copied from interface: IWebResourceSet
      Remove all items.
      Specified by:
      removeAll in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Returns:
      EChange
    • getAllItems

      @Nonnull @ReturnsMutableCopy public com.helger.commons.collection.impl.ICommonsOrderedSet<com.helger.html.resource.js.IJSPathProvider> getAllItems()
      Specified by:
      getAllItems in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Returns:
      A non-null set with all items.
    • getAllItems

      public void getAllItems(@Nonnull Collection<? super com.helger.html.resource.js.IJSPathProvider> aTarget)
      Description copied from interface: IWebResourceSet
      Add all items to the provided target container.
      Specified by:
      getAllItems in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Parameters:
      aTarget - The container to add the items to. May not be null.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Returns:
      true if no item is contained
    • isNotEmpty

      public boolean isNotEmpty()
      Specified by:
      isNotEmpty in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
      Returns:
      true if at least a single item is contained
    • getCount

      @Nonnegative public int getCount()
      Specified by:
      getCount in interface com.helger.commons.collection.impl.ICommonsIterable<com.helger.html.resource.js.IJSPathProvider>
    • iterator

      @Nonnull public Iterator<com.helger.html.resource.js.IJSPathProvider> iterator()
      Specified by:
      iterator in interface Iterable<com.helger.html.resource.js.IJSPathProvider>
    • isCollected

      public boolean isCollected()
    • markAsCollected

      public void markAsCollected()
      Description copied from interface: IWebResourceSet
      Call this method to mark the resource set as "collected for further processing". This state may be used to determine additions afterwards which will potentially not be gathered.
      Specified by:
      markAsCollected in interface IWebResourceSet<com.helger.html.resource.js.IJSPathProvider>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object