Package org.apache.ofbiz.widget
Class WidgetFactory
- java.lang.Object
-
- org.apache.ofbiz.widget.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
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ModelScreenWidget
getModelScreenWidget(ModelScreen modelScreen, org.w3c.dom.Element element)
Returns aModelScreenWidget
instance that implements the specified XML element.protected static void
loadStandardWidgets()
Loads the standard OFBiz screen widgets.static void
registerScreenWidget(java.lang.String tagName, java.lang.Class<? extends ModelScreenWidget> widgetClass)
Registers a screen sub-widget with the factory.
-
-
-
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 aModelScreenWidget
instance that implements the specified XML element.- Parameters:
modelScreen
- The containing screen for the widgetelement
- 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 anElement
instance.- Parameters:
tagName
- The XML element tag name for this widgetwidgetClass
- The class that implements the widget element- Throws:
java.lang.SecurityException
java.lang.NoSuchMethodException
-
-