Defaults to ThemeSwitcherCfg
. Type of the configuration object for this widget.
Creates a new instance of this widget. Please note that you should NOT override this constructor. Instead, override the init method, which is called at the end of the constructor once the instance is created.
The widget configuration to be used for this widget
instance. This widget configuration is usually created on the server by the javax.faces.render.Renderer
for
this component.
The configuration of this widget instance. Please note that
no property is guaranteed to be present, you should always check for undefined
before accessing a property.
This is partly because the value of a property is not transmitted from the server to the client when it equals
the default.
Whether the value of this widget was changed from its original value.
The DOM element for the input field that lets the user enter a custom value which does not have to match one of the available options.
The custom value that was entered by the user which does not have to match one the available options.
Array of registered listeners invoked when this widget is destroyed. You should normally not use modify this directly, use addDestroyListener instead.
Whether this widget is currently disabled.
The DOM element for the input field that lets the user enter a search term to filter the list of available options.
The filter that was selected and is currently used.
Map between the available filter types and the filter implementation.
The hidden input that can be focused via the tab key etc.
The client-side ID of this widget, with all parent naming containers, such as
myForm:myWidget
. This is also the ID of the container HTML element for this widget. In case the widget needs
multiple container elements (such as Paginator), this may also be an array if IDs.
The DOM element for the hidden input with the current value.
Whether the contents of the overlay panel were loaded.
The DOM element for the container with the available selectable options.
The DOM element for the wrapper with the container with the available selectable options.
The DOM elements for the the available selectable options.
The jQuery instance of the container element of this widget. In case id is an array, it will contain multiple elements. Please note that some widgets have got not DOM elements at all, in this case this will be an empty jQuery instance.
A CSS selector for the container element (or elements, in case id is an array) of
this widget, This is usually an ID selector (that is properly escaped). You can select the container element or
elements like this: $(widget.jqId)
.
The DOM element for the label indicating the currently selected option.
The DOM element for the icon for bringing up the overlay panel.
The number of option groups.
The DOM elements for the available selectable options.
The DOM element for the overlay panel with the available selectable options.
ID of the DOM element for the overlay panel with the available selectable options.
The adjusted width of the overlay panel.
The DOM element for the selected option that is shown before the overlay panel is brought up.
Array of registered listeners invoked when this widget is refreshed. You should normally not use modify this directly, use addRefreshListener instead.
ID of the timeout for the delay of the filter input in the overlay panel.
The DOM elements for the buttons that can trigger (hide or show) the overlay panel with the available selectable options.
The current value of this select one menu.
The name of the widget variables of this widget. The widget variable can be used to
access a widget instance by calling PF('myWidgetVar')
.
This render method is called by this deferred widget once the widget container has become visible. You may now proceed with widget initialization.
Must be overridden, or an error will be thrown.
Adds a deferred rendering task for the given widget to the queue.
The ID of a deferred widget.
The container element that should be visible.
Callback that is invoked when the widget may possibly have become visible.
Should return true
when the widget was rendered, or false
when the widget still needs to be rendered
later.
Lets you register a listener that is called before the component is destroyed.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. When the element is removed from the DOM by the update, the DOM element is detached from the DOM and all destroy listeners are called. This makes it possible to add listeners from outside the widget code.
If you call this method twice with the same listener, it will be registered twice and later also called twice.
Note that for this to work, you must not override the destroy
method; or if you do, call super
.
Also, after this widget was detached is done, all destroy listeners will be unregistered.
A destroy listener to be registered.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, all refresh listeners are called. This makes it possible to add listeners from outside the widget code.
If you call this method twice with the same listener, it will be registered twice and later also called twice.
Note that for this to work, you must not override the refresh
method; or if you do, call super
.
Also, after the refresh is done, all refresh listeners will be deregistered. If you added the listeners from
within this widget, consider adding the refresh listeners not only in the init
method, but also again in
the refresh
method after calling super
.
A refresh listener to be registered.
Align the overlay panel with the available selectable options so that is is positioned next to the the button.
Removes focus from this widget.
Each widget may have one or several behaviors attached to it. This method calls all attached behaviors for the given event name. In case no such behavior exists, this method does nothing and returns immediately.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event to call.
Additional configuration that is passed to the AJAX request for the server-side callback.
Implementation of a PrimeFaces.widget.SelectOneMenu.FilterFunction
that matches the given option when it
contains the given search text.
Text of an option.
Value of the filter.
true
when the text of the contains the filter value, or false
otherwise.
Cleans up deferred render tasks. When you extend this class and override this method, make sure to call
super
.
Disables this widget so that the user cannot select any option.
Enables this widget so that the user can select an option.
Implementation of a PrimeFaces.widget.SelectOneMenu.FilterFunction
that matches the given option when it ends
with the given search text.
Text of an option.
Value of the filter.
true
when the text of the options ends with the filter value, or false
otherwise.
Filters the available options in the overlay panel by the given search value. Note that this does not bring up
the overlay panel, use show
for that.
A value against which the available options are matched.
Puts focus on this widget.
Puts focus on the filter input in the overlay panel.
Amount of time in milliseconds to wait before attempting to focus the input.
Finds the element for the currently select option of this select one menu.
The DOM element that represents the currently selected option.
Each widget may have one or several behaviors attached to it. This method returns the callback function for the given event.
Note: Do not call the method directly, the recommended way to invoke a behavior is via callBehavior.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event for which to retrieve the behavior.
The behavior with the given name, or null
if no such behavior
exists.
Each widget has got a container element, this method returns that container. This container element is usually also the element whose ID is the client-side ID of the JSF component.
The jQuery instance representing the main HTML container element of this widget.
Finds the label of the currently selected item, if any.
The label of the currently selected item. Empty string if none is selected.
Finds the value of the currently selected item, if any.
The value of the currently selected item. Empty string if none is selected.
Each widget may have one or several behaviors attached to it. This method checks whether this widget has got at least one behavior associated with given event name.
A behavior is a way for associating client-side scripts with UI components that opens all sorts of possibilities, including client-side validation, DOM and style manipulation, keyboard handling, and more. When the behavior is triggered, the configured JavaScript gets executed.
Behaviors are often, but not necessarily, AJAX behavior. When triggered, it initiates a request the server
and processes the response once it is received. This enables several features such as updating or replacing
elements dynamically. You can add an AJAX behavior via
<p:ajax event="name" actionListener="#{...}" onstart="..." />
.
The name of an event to check.
true
if this widget has the given behavior, false
otherwise.
Hides the overlay panel with the available selectable options.
A widget class should not declare an explicit constructor, the default constructor provided by this base widget should be used. Instead, override this initialize method which is called after the widget instance was constructed. You can use this method to perform any initialization that is required. For widgets that need to create custom HTML on the client-side this is also the place where you should call your render method.
Please make sure to call the super method first before adding your own custom logic to the init method:
PrimeFaces.widget.MyWidget = PrimeFaces.widget.BaseWidget.extend({
init: function(cfg) {
this._super(cfg);
// custom initialization
}
});
The widget configuration to be used for this widget instance.
This widget configuration is usually created on the server by the javax.faces.render.Renderer
for this
component.
Checks if this widget is detached, ie whether the HTML element of this widget is currently contained within the DOM (the HTML body element). A widget may become detached during an AJAX update, and it may remain detached in case the update removed this component from the component tree.
true
if this widget is currently detached, or false
otherwise.
Called after the widget has become visible and after it was rendered. May be overridden, the default implementation is a no-op.
Used in ajax updates, reloads the widget configuration.
When an AJAX call is made and this component is updated, the DOM element is replaced with the newly rendered content. However, no new instance of the widget is created. Instead, after the DOM element was replaced, this method is called with the new widget configuration from the server. This makes it possible to persist client-side state during an update, such as the currently selected tab.
Please note that instead of overriding this method, you should consider adding a refresh listener instead via addRefreshListener. This has the advantage of letting you add multiple listeners, and makes it possible to add additional listeners from code outside this widget.
By default, this method calls all refresh listeners, then reinitializes the widget by calling the init
method.
The new widget configuration from the server.
The value as returned by the init
method, which is often undefined
.
Removes the widget's script block from the DOM. Currently, the ID of this script block consists of the
client-side ID of this widget with the prefix _s
, but this is subject to change.
The client-side ID of the widget.
This render method to check whether the widget container is visible. Do not override this method, or the deferred widget functionality may not work properly anymore.
true
if the widget container is visible, false
or
undefined
otherwise.
Finds the index of the given selectable option.
One of the available selectable options.
The index of the given item.
Unselect the selected item, if any, and select the please select
option.
Selects the option with the given value.
Value of the option to select.
Brings up the overlay panel with the available selectable options.
Implementation of a PrimeFaces.widget.SelectOneMenu.FilterFunction
that matches the given option when it starts
with the given search text.
Text of an option.
Value of the filter.
true
when the text of the options starts with the filter value, or false
otherwise.
Updates the style class of the label that indicates the currently selected item.
true
if a placeholder should be displayed, or false
otherwise.
Generated using TypeDoc
PrimeFaces ThemeSwitcher Widget
ThemeSwitcher enables switching PrimeFaces themes on the fly with no page refresh.