Package org.openbravo.client.myob
Class WidgetProvider
- java.lang.Object
-
- org.openbravo.client.myob.WidgetProvider
-
- Direct Known Subclasses:
CalendarWidgetProvider
,CommunityBrandingWidgetProvider
,GoogleCalendarWidgetProvider
,HTMLWidgetProvider
,QueryListWidgetProvider
,ShowParameterWidgetProvider
,TwitterWidgetProvider
,URLWidgetProvider
public abstract class WidgetProvider extends Object
Responsible for creating a widget definition. NOTE: must be instantiated through theMyOBUtils.getWidgetProvider(WidgetClass)
method.- Author:
- mtaal
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
FIELDDEFINITIONS
protected static String
PARAMETERS
static String
TITLE
static String
WIDGETCLASSID
-
Constructor Summary
Constructors Modifier Constructor Description protected
WidgetProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addDefaultWidgetProperties(org.codehaus.jettison.json.JSONObject jsonObject, WidgetInstance widgetInstance)
static Map<String,String>
createValueMap(Set<String> allowedValues, String referenceId)
String
generate()
As a default will generate javascript which extends the OBShowParameterWidget widget.String
getClientSideWidgetClassName()
Map<String,Object>
getParameters()
WidgetClass
getWidgetClass()
org.codehaus.jettison.json.JSONObject
getWidgetClassDefinition()
org.codehaus.jettison.json.JSONObject
getWidgetInstanceDefinition(WidgetInstance widgetInstance)
void
setParameters(Map<String,Object> parameters)
void
setWidgetClass(WidgetClass widgetClass)
boolean
validate()
Override this method to make validations on widget classes.
-
-
-
Field Detail
-
WIDGETCLASSID
public static final String WIDGETCLASSID
- See Also:
- Constant Field Values
-
TITLE
public static final String TITLE
- See Also:
- Constant Field Values
-
PARAMETERS
protected static final String PARAMETERS
- See Also:
- Constant Field Values
-
FIELDDEFINITIONS
protected static final String FIELDDEFINITIONS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getWidgetClassDefinition
public org.codehaus.jettison.json.JSONObject getWidgetClassDefinition()
-
addDefaultWidgetProperties
protected void addDefaultWidgetProperties(org.codehaus.jettison.json.JSONObject jsonObject, WidgetInstance widgetInstance) throws org.codehaus.jettison.json.JSONException
- Throws:
org.codehaus.jettison.json.JSONException
-
getClientSideWidgetClassName
public String getClientSideWidgetClassName()
-
generate
public String generate()
As a default will generate javascript which extends the OBShowParameterWidget widget.
-
getWidgetInstanceDefinition
public org.codehaus.jettison.json.JSONObject getWidgetInstanceDefinition(WidgetInstance widgetInstance)
-
createValueMap
public static Map<String,String> createValueMap(Set<String> allowedValues, String referenceId)
-
getWidgetClass
public WidgetClass getWidgetClass()
-
setWidgetClass
public void setWidgetClass(WidgetClass widgetClass)
-
validate
public boolean validate()
Override this method to make validations on widget classes. If this method returns false the widget class won't be available for users to add new instances.- Returns:
- true if the widget class definition is valid.
-
-