Package org.primefaces.util
Class WidgetBuilder
- java.lang.Object
-
- org.primefaces.util.WidgetBuilder
-
public class WidgetBuilder extends Object
Helper to generate scripts for widgets.
-
-
Field Summary
Fields Modifier and Type Field Description protected PrimeConfigurationconfigurationprotected javax.faces.context.FacesContextcontextprotected booleanendFunction
-
Constructor Summary
Constructors Constructor Description WidgetBuilder(javax.faces.context.FacesContext context, PrimeConfiguration configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description WidgetBuilderappend(char chr)WidgetBuilderappend(Number number)WidgetBuilderappend(String str)WidgetBuilderattr(String name, boolean value, boolean defaultValue)WidgetBuilderattr(String name, double value, double defaultValue)WidgetBuilderattr(String name, int value, int defaultValue)WidgetBuilderattr(String name, Boolean value)WidgetBuilderattr(String name, Number value)WidgetBuilderattr(String name, String value)WidgetBuilderattr(String name, String value, String defaultValue)WidgetBuildercallback(String name, String callback)WidgetBuildercallback(String name, String signature, String callback)voidfinish()WidgetBuilderinit(String widgetClass, String widgetVar, String id)Deprecated.protected WidgetBuilderinit(String widgetClass, String widgetVar, String id, boolean endFunction)<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinit(String widgetClass, T widget)WidgetBuilderinitWithComponentLoad(String widgetClass, String widgetVar, String id, String targetId)<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinitWithComponentLoad(String widgetClass, T widget, String targetId)WidgetBuilderinitWithWindowLoad(String widgetClass, String widgetVar, String id)<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinitWithWindowLoad(String widgetClass, T widget)WidgetBuildernativeAttr(String name, String value)WidgetBuildernativeAttr(String name, String value, String defaultValue)protected WidgetBuilderrenderLifecycleCallbacks(javax.faces.component.UIComponent component)protected voidrenderScriptBlock(String id)WidgetBuilderreturnCallback(String name, String signature, String callback)WidgetBuilderselectorAttr(String name, String value)This should only be used internally if the selector is directly used by jQuery on the client.
-
-
-
Field Detail
-
endFunction
protected boolean endFunction
-
context
protected javax.faces.context.FacesContext context
-
configuration
protected PrimeConfiguration configuration
-
-
Constructor Detail
-
WidgetBuilder
public WidgetBuilder(javax.faces.context.FacesContext context, PrimeConfiguration configuration)
-
-
Method Detail
-
init
protected WidgetBuilder init(String widgetClass, String widgetVar, String id, boolean endFunction) throws IOException
- Parameters:
widgetClass- Constructor name of the widgetwidgetVar- Name of the client side widgetid- Client id of the componentendFunction- If the init script is wrapped by a method and if the endFunction parentheses should be rendered.- Returns:
- The current instance.
- Throws:
IOException
-
init
public <T extends javax.faces.component.UIComponent & Widget> WidgetBuilder init(String widgetClass, T widget) throws IOException
- Throws:
IOException
-
init
@Deprecated public WidgetBuilder init(String widgetClass, String widgetVar, String id) throws IOException
Deprecated.Useinit(String, UIComponent)instead- Throws:
IOException
-
initWithWindowLoad
public <T extends javax.faces.component.UIComponent & Widget> WidgetBuilder initWithWindowLoad(String widgetClass, T widget) throws IOException
- Throws:
IOException
-
initWithWindowLoad
public WidgetBuilder initWithWindowLoad(String widgetClass, String widgetVar, String id) throws IOException
- Throws:
IOException
-
initWithComponentLoad
public <T extends javax.faces.component.UIComponent & Widget> WidgetBuilder initWithComponentLoad(String widgetClass, T widget, String targetId) throws IOException
- Throws:
IOException
-
initWithComponentLoad
public WidgetBuilder initWithComponentLoad(String widgetClass, String widgetVar, String id, String targetId) throws IOException
- Throws:
IOException
-
renderScriptBlock
protected void renderScriptBlock(String id) throws IOException
- Throws:
IOException
-
renderLifecycleCallbacks
protected WidgetBuilder renderLifecycleCallbacks(javax.faces.component.UIComponent component) throws IOException
- Throws:
IOException
-
selectorAttr
public WidgetBuilder selectorAttr(String name, String value) throws IOException
This should only be used internally if the selector is directly used by jQuery on the client. If PFS is used and specified by the user,attr(java.lang.String, java.lang.String)should be used as the users have to escape colons like @(myForm\:myId).- Parameters:
name-value-- Returns:
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, String value) throws IOException
- Throws:
IOException
-
nativeAttr
public WidgetBuilder nativeAttr(String name, String value) throws IOException
- Throws:
IOException
-
nativeAttr
public WidgetBuilder nativeAttr(String name, String value, String defaultValue) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, Boolean value) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, Number value) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, String value, String defaultValue) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, double value, double defaultValue) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, int value, int defaultValue) throws IOException
- Throws:
IOException
-
attr
public WidgetBuilder attr(String name, boolean value, boolean defaultValue) throws IOException
- Throws:
IOException
-
callback
public WidgetBuilder callback(String name, String signature, String callback) throws IOException
- Throws:
IOException
-
returnCallback
public WidgetBuilder returnCallback(String name, String signature, String callback) throws IOException
- Throws:
IOException
-
callback
public WidgetBuilder callback(String name, String callback) throws IOException
- Throws:
IOException
-
append
public WidgetBuilder append(String str) throws IOException
- Throws:
IOException
-
append
public WidgetBuilder append(char chr) throws IOException
- Throws:
IOException
-
append
public WidgetBuilder append(Number number) throws IOException
- Throws:
IOException
-
finish
public void finish() throws IOException- Throws:
IOException
-
-