Class Renderer<NC,P extends IRenderingParameters>

java.lang.Object
com._1c.g5.aef2.renderers.Renderer<NC,P>
All Implemented Interfaces:
IRenderer<P>
Direct Known Subclasses:
LwtRenderer, SwtRenderer

public abstract class Renderer<NC,P extends IRenderingParameters> extends Object implements IRenderer<P>
Base AEF renderer implementation.
  • Constructor Details

    • Renderer

      public Renderer()
  • Method Details

    • setTreeTransformation

      public void setTreeTransformation(ITreeTransformation treeTransformation)
      Sets the ITreeTransformation instance.. Cannot be null.
      Specified by:
      setTreeTransformation in interface IRenderer<NC>
    • initialize

      public void initialize(P parameters)
      Initialized the renderer with the given parameters.

      To load view model to view mappings from the extension point, call loadMappings(String).

      Specified by:
      initialize in interface IRenderer<NC>
      Parameters:
      parameters - the renderer parameters.
    • findViewClass

      protected <VM extends IControlViewModel> Class<? extends IView> findViewClass(VM viewModel)
      Finds the view class for the given view model.
      Parameters:
      viewModel - the view model.
      Returns:
      the found view class or null if not found.
    • createView

      protected <VM extends IControlViewModel> IView<?,VM,NC> createView(VM viewModel)
      Creates a view for a given view model consulting the view model class to view class mapping.
      Parameters:
      viewModel - the view model to create view for.
      Returns:
      the created view model.
      Throws:
      IllegalStateException - if view can't be created.
      See Also:
    • applyLayout

      protected abstract void applyLayout(IControlViewModel viewModel, NC nativeControl)
      Applies a layout to the given native control.
      Parameters:
      viewModel - the associated view model.
      nativeControl - the native control to apply layout to.
    • convertLayout

      protected abstract Object convertLayout(IAefLayout layout, NC nativeControl)
      Converts the AEF layout to layout for the given native control.
      Parameters:
      layout - the AEF layout.
      Returns:
      the converted layout object.
    • convertLayoutData

      protected abstract Object convertLayoutData(IAefLayoutData layoutData, NC nativeControl)
      Converts the AEF layout data to layout data for the given native control.
      Parameters:
      layoutData - the AEF layout data.
      Returns:
      the converted layout data object.
    • setMapping

      protected final void setMapping(Class<? extends IControlViewModel> viewModel, Class<? extends IView> view)
      Sets a mapping between the given view model class and view class.
      Parameters:
      viewModel - the view model class.
      view - the view class.
      See Also:
    • getParameters

      protected final P getParameters()
      Returns:
      this renderer rendering parameters.
    • getTreeTransformation

      protected ITreeTransformation getTreeTransformation()
      Returns the TreeTransformation instance.
      Returns:
      the TreeTransformation instance.
    • getTargetId

      protected abstract String getTargetId()
      Returns the target identifier of the renderer.

      This identifier will be used to obtain view model to view mappings from the extension point in loadMappings(String).

      Examples:

      • swt
      • lwt
      Returns:
      the target id
    • loadMappings

      protected final void loadMappings(String rendererId)
      Loads view model to view mappings from the com._1c.g5.aef2.Aef2Plugin.renderer extension point.

      This method should be called from initialize(IRenderingParameters).

      Parameters:
      rendererId - the renderer identifier to load mappings for