Class PrototypeProvision<P extends Prototype>

  • Type Parameters:
    P - The type of prototype being provided.
    All Implemented Interfaces:
    java.lang.Comparable<PrototypeProvision<P>>

    public class PrototypeProvision<P extends Prototype>
    extends com.globalmentor.model.AbstractHashObject
    implements java.lang.Comparable<PrototypeProvision<P>>
    Prototype provision information indicating order, hierarchy, and location for generated components. This description is usually used to generate components and place them in menus and/or toolbars.
    Author:
    Garret Wilson
    • Constructor Detail

      • PrototypeProvision

        public PrototypeProvision​(P prototype,
                                  int order,
                                  boolean isMenu,
                                  boolean isTool)
        Prototype constructor with no prototype description parent.
        Parameters:
        prototype - The prototype.
        order - The order of the prototype.
        isMenu - Whether this prototype should be used in a menu if available.
        isTool - Whether this prototype should be used in a toolbar if available.
        Throws:
        java.lang.NullPointerException - if the given prototype is null.
        java.lang.IllegalArgumentException - if the given order is not -1 and does not come between 0 and 2147483647, inclusive.
      • PrototypeProvision

        public PrototypeProvision​(PrototypeProvision<?> parentPrototypeProvision,
                                  P prototype,
                                  int order,
                                  boolean isMenu,
                                  boolean isTool)
        Parent prototype description and prototype constructor.
        Parameters:
        parentPrototypeProvision - The prototype description's parent, or null if the prototype description has no parent.
        prototype - The prototype.
        order - The order of the prototype.
        isMenu - Whether this prototype should be used in a menu if available.
        isTool - Whether this prototype should be used in a toolbar if available.
        Throws:
        java.lang.NullPointerException - if the given prototype is null.
        java.lang.IllegalArgumentException - if the given order is not -1 and does not come between 0 and 2147483647, inclusive.
    • Method Detail

      • getParentPrototypeProvision

        public PrototypeProvision<?> getParentPrototypeProvision()
        Returns:
        The prototype's parent, or null if the prototype description has no parent.
      • getPrototype

        public P getPrototype()
        Returns:
        The prototype being described.
      • getOrder

        public int getOrder()
        Returns:
        The order of the prototype.
      • isMenu

        public boolean isMenu()
        Returns:
        Whether this prototype should be used in a menu if available.
      • isTool

        public boolean isTool()
        Returns:
        Whether this prototype should be used in a toolbar if available.
      • compareTo

        public int compareTo​(PrototypeProvision<P> prototypeDescription)
        Specified by:
        compareTo in interface java.lang.Comparable<P extends Prototype>