Class CodeRoot<D extends CodeRootDelegate>

java.lang.Object
org.praxislive.code.CodeComponent<D>
org.praxislive.code.CodeRoot<D>
Type Parameters:
D - wrapped delegate type
All Implemented Interfaces:
Component, Lookup.Provider, Root
Direct Known Subclasses:
CodeRootContainer

public class CodeRoot<D extends CodeRootDelegate> extends CodeComponent<D> implements Root
A Root component instance that is rewritable at runtime. The CodeRoot itself remains constant, but passes most responsibility to a CodeRoot.Context wrapping a CodeRootDelegate (user code). This component handles switching from one context to the next. A CodeRoot cannot be created directly - see CodeFactory.
  • Method Details

    • initialize

      public Root.Controller initialize(String ID, RootHub hub)
      Description copied from interface: Root
      Method used by the RootHub to initialize the Root and obtain a Controller. Root implementations will ensure this method can only be invoked once.
      Specified by:
      initialize in interface Root
      Parameters:
      ID - the unique ID of this Root
      hub - the RootHub the Root resides within
      Returns:
      Controller for use by the RootHub instance
    • getLookup

      public Lookup getLookup()
      Description copied from interface: Lookup.Provider
      Get the Lookup from this Provider.
      Specified by:
      getLookup in interface Lookup.Provider
      Returns:
      lookup
    • parentNotify

      public void parentNotify(Container parent) throws VetoException
      Description copied from interface: Component
      Notify the Component that it has been added to the supplied Container, or removed from its parent if the supplied argument is null. The Component may throw a VetoException if it should not be added to the Container provided. It should also throw this exception if a parent is already set.
      Specified by:
      parentNotify in interface Component
      Overrides:
      parentNotify in class CodeComponent<D extends CodeRootDelegate>
      Parameters:
      parent -
      Throws:
      VetoException
    • hierarchyChanged

      public void hierarchyChanged()
      Description copied from interface: Component
      Notify the component that a change has happened in its component hierarchy. For example its direct parent or an ancestor has changed. This method will be called after parentNotify() if the result of an immediate parent change.
      Specified by:
      hierarchyChanged in interface Component
      Overrides:
      hierarchyChanged in class CodeComponent<D extends CodeRootDelegate>