public class CCRating extends AjaxDynamicElement
CCRating is a fully customizable CSS based ratings widget. By default it acts as an input. Alternatively, it can notify the server when the rating is changed, update the bound value, and call an action method.
It uses four (customizable) CSS class names to determine each link's state:
Rating: CCRating { value = rating; }
Rating: CCRating { value = rating; actAsInput = false; }
Rating: CCRating { value = rating; actAsInput = false; action = rated; }
Rating: CCRating { value = rating; min = 1; max = 10; multiple = true; }
Name | Description |
---|---|
value | the value to show in the ratings widget and the value set when the user selects a different rating |
actAsInput | optional, default is true , if false updates the value binding when clicked and optionally calls action method |
action | optional, action method to fire when rating changed. Ignored if actAsInput is true or unbound |
min | optional, the value sent to the server when the lowest rating is selected, indirectly controls the number of rating points displayed |
max | optional, the value sent to the server when the highest rating is selected, indirectly controls the number of rating points displayed |
multiple | optional, true if the user can change a previous rating |
id | optional, HTML ID for the div and Control.Rating widget |
capture | optional, stops the click event on each rating from propagating |
style | optional CSS style for container element |
class | optional CSS class for container element in addition to the standard rating_container class |
classNames | optional, dictionary of state names and CSS class names with state names of: off, half, on, selected |
rated | optional, true if this has already been rated |
reverse | optional, true if the links should be shown in reverse order |
updateOptions | highly optional, Ajax Options for the request |
formValueName | optional, the name of the form value that will contain the value |
elementName | optional, defaults to div, the name of the HTML element to use to hold the rating UI |
afterChange, | optional, script to run client side after a change e.g. afterChange = "alert(v)";. Receives one parameter, v, the new value selected |
ERXDynamicElement.ContextData<T>
log
Constructor and Description |
---|
CCRating(String name,
NSDictionary associations,
com.webobjects.appserver.WOElement children) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
actAsInput(com.webobjects.appserver.WOContext context) |
protected void |
addRequiredWebResources(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
Override this method to append the needed scripts for this component.
|
void |
appendToResponse(com.webobjects.appserver.WOResponse response,
com.webobjects.appserver.WOContext context)
Build div, optional input, and JavaScript into response.
|
protected NSMutableDictionary |
createOptions(com.webobjects.appserver.WOContext context)
Produce dictionary for options object for Control.Rating.
|
protected String |
formValueName(com.webobjects.appserver.WOContext context) |
com.webobjects.appserver.WOActionResults |
handleRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Handles server action if this is not being use as an input.
|
String |
id(com.webobjects.appserver.WOContext context)
Return the value of the id binding if it exists or a safe identifier
otherwise.
|
protected void |
setValueFromFormValue(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Sets the value binding based on the form value.
|
void |
takeValuesFromRequest(com.webobjects.appserver.WORequest request,
com.webobjects.appserver.WOContext context)
Sets value binding if this is being used as an input.
|
_containerID, addScriptResourceInHead, addScriptResourceInHead, addStylesheetResourceInHead, addStylesheetResourceInHead, invokeAction, shouldHandleRequest
afterProcessing, appendTagAttributeToResponse, arrayValueForBinding, arrayValueForBinding, associations, beforeProcessing, bindingIsSettable, bindingNamed, booleanValueForBinding, booleanValueForBinding, hasBinding, integerValueForBinding, nameInContext, secureInContext, setValueForBinding, stringValueForBinding, stringValueForBinding, valueForBinding, valueForBinding
addChildElement, appendChildrenToResponse, childrenElements, EmptyGroup, hasChildrenElements, invokeChildrenAction, takeChildrenValuesFromRequest, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
valueForBinding, valueForBinding
public CCRating(String name, NSDictionary associations, com.webobjects.appserver.WOElement children)
protected void addRequiredWebResources(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
AjaxDynamicElement
addRequiredWebResources
in class AjaxDynamicElement
response
- the current responsecontext
- context of the transactionpublic void appendToResponse(com.webobjects.appserver.WOResponse response, com.webobjects.appserver.WOContext context)
appendToResponse
in class AjaxDynamicElement
response
- the current responsecontext
- context of the transactionAjaxDynamicElement.appendToResponse(com.webobjects.appserver.WOResponse, com.webobjects.appserver.WOContext)
protected NSMutableDictionary createOptions(com.webobjects.appserver.WOContext context)
context
- WOContext providing component to resolve bindings inpublic com.webobjects.appserver.WOActionResults handleRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
handleRequest
in interface IAjaxElement
handleRequest
in class AjaxDynamicElement
request
- the current requestcontext
- context of the transactionAjaxDynamicElement.handleRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
,
takeValuesFromRequest(WORequest, WOContext)
public void takeValuesFromRequest(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
takeValuesFromRequest
in class com.webobjects.appserver._private.WODynamicGroup
WODynamicGroup.takeValuesFromRequest(com.webobjects.appserver.WORequest, com.webobjects.appserver.WOContext)
,
handleRequest(WORequest, WOContext)
protected void setValueFromFormValue(com.webobjects.appserver.WORequest request, com.webobjects.appserver.WOContext context)
request
- the WORequest to get the form values fromcontext
- WOContext used to determine component used intakeValuesFromRequest(WORequest, WOContext)
,
handleRequest(WORequest, WOContext)
protected String formValueName(com.webobjects.appserver.WOContext context)
context
- WOContext used to determine component used inpublic String id(com.webobjects.appserver.WOContext context)
ERXDynamicElement
id
in class ERXDynamicElement
context
- WOContext used to determine component used inprotected boolean actAsInput(com.webobjects.appserver.WOContext context)
context
- WOContext used to determine component used intrue
if unboundCopyright © 2002 – 2020 Project Wonder.