Class WidgetFactory


  • public class WidgetFactory
    extends java.lang.Object
    Screen widget factory.

    Applications can add their own widget implementations to the factory by implementing the WidgetLoader interface.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String module  
      protected static java.util.Map<java.lang.String,​java.lang.reflect.Constructor<? extends ModelScreenWidget>> screenWidgets  
    • Field Detail

      • module

        public static final java.lang.String module
      • screenWidgets

        protected static final java.util.Map<java.lang.String,​java.lang.reflect.Constructor<? extends ModelScreenWidget>> screenWidgets
    • Method Detail

      • getModelScreenWidget

        public static ModelScreenWidget getModelScreenWidget​(ModelScreen modelScreen,
                                                             org.w3c.dom.Element element)
        Returns a ModelScreenWidget instance that implements the specified XML element.
        Parameters:
        modelScreen - The containing screen for the widget
        element - The widget XML element
        Returns:
        a ModelScreenWidget instance that implements the specified XML element
        Throws:
        java.lang.IllegalArgumentException
      • loadStandardWidgets

        protected static void loadStandardWidgets()
        Loads the standard OFBiz screen widgets.
      • registerScreenWidget

        public static void registerScreenWidget​(java.lang.String tagName,
                                                java.lang.Class<? extends ModelScreenWidget> widgetClass)
                                         throws java.lang.SecurityException,
                                                java.lang.NoSuchMethodException
        Registers a screen sub-widget with the factory. If a tag name is already registered, the new widget replaces the existing one.

        The class supplied to the method must have a public two-argument constructor that takes a ModelScreen instance and an Element instance.

        Parameters:
        tagName - The XML element tag name for this widget
        widgetClass - The class that implements the widget element
        Throws:
        java.lang.SecurityException
        java.lang.NoSuchMethodException