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 PrimeConfiguration
configuration
protected javax.faces.context.FacesContext
context
protected boolean
endFunction
-
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 WidgetBuilder
append(char chr)
WidgetBuilder
append(Number number)
WidgetBuilder
append(String str)
WidgetBuilder
attr(String name, boolean value, boolean defaultValue)
WidgetBuilder
attr(String name, double value, double defaultValue)
WidgetBuilder
attr(String name, int value, int defaultValue)
WidgetBuilder
attr(String name, Boolean value)
WidgetBuilder
attr(String name, Number value)
WidgetBuilder
attr(String name, String value)
WidgetBuilder
attr(String name, String value, String defaultValue)
WidgetBuilder
callback(String name, String callback)
WidgetBuilder
callback(String name, String signature, String callback)
void
finish()
WidgetBuilder
init(String widgetClass, String widgetVar, String id)
Deprecated.protected WidgetBuilder
init(String widgetClass, String widgetVar, String id, boolean endFunction)
<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinit(String widgetClass, T widget)
WidgetBuilder
initWithComponentLoad(String widgetClass, String widgetVar, String id, String targetId)
<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinitWithComponentLoad(String widgetClass, T widget, String targetId)
WidgetBuilder
initWithWindowLoad(String widgetClass, String widgetVar, String id)
<T extends javax.faces.component.UIComponent & Widget>
WidgetBuilderinitWithWindowLoad(String widgetClass, T widget)
WidgetBuilder
nativeAttr(String name, String value)
WidgetBuilder
nativeAttr(String name, String value, String defaultValue)
protected WidgetBuilder
renderLifecycleCallbacks(javax.faces.component.UIComponent component)
protected void
renderScriptBlock(String id)
WidgetBuilder
returnCallback(String name, String signature, String callback)
WidgetBuilder
selectorAttr(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
-
-