Class LXViewEngine

java.lang.Object
heronarts.lx.LXComponent
heronarts.lx.structure.view.LXViewEngine
All Implemented Interfaces:
LX.Listener, LXPath, LXSerializable, LXParameterListener

public class LXViewEngine extends LXComponent implements LX.Listener
  • Field Details

  • Constructor Details

    • LXViewEngine

      public LXViewEngine(LX lx)
  • Method Details

    • modelGenerationChanged

      public void modelGenerationChanged(LX lx, LXModel model)
      Description copied from interface: LX.Listener
      Fired when the generation of a model has been changed. This is the same model instance that has already been set on LX, but it has been modified. This is also fired the very first time a model is set (e.g. generation 0 for the model). Listeners that wish to take generic action based upon any new model geometry, whether it's an existing or new model, may listen to just this method.
      Specified by:
      modelGenerationChanged in interface LX.Listener
      Parameters:
      lx - LX instance
      model - model instance
    • addListener

      public LXViewEngine addListener(LXViewEngine.Listener listener)
      Registers a listener to the view engine
      Parameters:
      listener - View listener
      Returns:
      this
    • removeListener

      public LXViewEngine removeListener(LXViewEngine.Listener listener)
      Unregisters a listener to the palette
      Parameters:
      listener - Palette listener
      Returns:
      this
    • addView

      public LXViewDefinition addView()
      Add a new, uninitialized view
      Returns:
      View that's added
    • addView

      public LXViewDefinition addView(JsonObject viewObj, int index)
      Adds a view at the given index
      Parameters:
      viewObj - Saved view object
      index - Index to save at
      Returns:
      View object
    • removeView

      public LXViewEngine removeView(LXViewDefinition view)
      Removes a view from the view engine's list
      Parameters:
      view - View to remove
      Returns:
      this
    • moveView

      public LXViewEngine moveView(LXViewDefinition view, int index)
      Moves a saved view to a different position in the list
      Parameters:
      view - Saved view
      index - New index for that view
      Returns:
      this
    • reset

      public void reset()
    • newViewSelector

      public LXViewEngine.SelectorNormal newViewSelector(String label, String description)
    • newViewSelectorPriority

      public LXViewEngine.SelectorPriority newViewSelectorPriority(String label, String description)
    • dispose

      public void dispose()
      Description copied from class: LXComponent
      Invoked when a component is being removed from the system and will no longer be used at all. This unregisters the component and should free up any resources and parameter listeners. Ideally after this method is called the object should be eligible for garbage collection. Subclasses are generally expected to override this method to handle their particular cleanup work. They should also generally call super.dispose() at the appropriate time to perform the basic cleanup, which may need to happen either before or after cleaning up other objects.
      Overrides:
      dispose in class LXComponent
    • save

      public void save(LX lx, JsonObject obj)
      Description copied from class: LXComponent
      Serializes the LX component. By default, all internal and user-facing parameters are serialized, as well as any explicitly registered child components. Note that child arrays are not serialized, or any other dynamic components. Subclasses may override to perform more saving, and are expected to call super.save(lx, obj) at the appropriate time.
      Specified by:
      save in interface LXSerializable
      Overrides:
      save in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to serialize into
    • load

      public void load(LX lx, JsonObject obj)
      Description copied from class: LXComponent
      Loads the LX component. Restores the ID of the component, as well as its internal and user-facing parameters. Any explicitly registered children will be automatically loaded, so long as they are direct descendants. Dynamic arrays will not be automatically loaded, this is left to subclasses to implement.
      Specified by:
      load in interface LXSerializable
      Overrides:
      load in class LXComponent
      Parameters:
      lx - LX instance
      obj - Object to deserialize
    • addViews

      public List<LXViewDefinition> addViews(LX lx, JsonObject obj)