Author: sergeyhalipov
Date: 2008-03-13 13:51:09 -0400 (Thu, 13 Mar 2008)
New Revision: 6794
Modified:
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2487
Modified:
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
===================================================================
---
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2008-03-13
17:41:37 UTC (rev 6793)
+++
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2008-03-13
17:51:09 UTC (rev 6794)
@@ -23,9 +23,12 @@
import java.io.IOException;
+import javax.faces.FacesException;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils;
import org.richfaces.component.UIInputNumberSlider;
@@ -47,5 +50,33 @@
public void writeEventHandlerFunction(FacesContext context, UIComponent component,
String eventName) throws IOException{
RendererUtils.writeEventHandlerFunction(context, component, eventName);
}
+
+ public void prepareVariables(FacesContext context, UIInputNumberSlider slider) {
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(this, slider);
+
+ String inputPosition = (String)slider.getAttributes().get("inputPosition");
+ if (!"right".equals(inputPosition) &&
!"left".equals(inputPosition)) {
+ inputPosition = "right";
+ }
+ variables.setVariable("inputPosition", inputPosition);
+ boolean disabled = attributeToBoolean(slider, "disabled");
+ boolean showInput = attributeToBoolean(slider, "showInput");
+ boolean manualInput = attributeToBoolean(slider, "enableManualInput");
+
+ variables.setVariable("showInput",new Boolean(showInput));
+ variables.setVariable("inputReadOnly",new Boolean(!manualInput));
+ variables.setVariable("inputDisabled",new Boolean(disabled));
+
+ if (!manualInput || disabled){
+ variables.setVariable("color", "color: gray;");
+ }
+ else{
+ variables.setVariable("color", "");
+ }
+
+ variables.setVariable("inputSize",
slider.getAttributes().get("inputSize"));
+ variables.setVariable("style", slider.getStyle());
+ }
+
}
Modified: trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2008-03-13
17:41:37 UTC (rev 6793)
+++ trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2008-03-13
17:51:09 UTC (rev 6794)
@@ -11,44 +11,24 @@
<h:styles>css/slider.xcss</h:styles>
<h:scripts>new
org.ajax4jsf.javascript.PrototypeScript(),script/SliderScript.js,/org/richfaces/renderkit/html/scripts/browser_info.js,/org/richfaces/renderkit/html/scripts/events.js</h:scripts>
- <f:clientid var="clientId"/>
+ <f:clientid var="clientId"/>
+
+ <f:call name="prepareVariables" />
<f:resource name="/org/richfaces/renderkit/html/images/spacer.gif"
var="spacer" />
<f:resource name="org.richfaces.renderkit.html.images.SliderArrowImage"
var="arrow" />
<f:resource
name="org.richfaces.renderkit.html.images.SliderArrowSelectedImage"
var="arrowSelected" />
- <jsp:scriptlet><![CDATA[
- String inputPosition =
(String)component.getAttributes().get("inputPosition");
-
- boolean disabled = attributeToBoolean(component, "disabled");
- boolean showInput = attributeToBoolean(component, "showInput");
- boolean manualInput = attributeToBoolean(component,
"enableManualInput");
-
- variables.setVariable("inputReadOnly",new Boolean(!manualInput));
- variables.setVariable("inputDisabled",new Boolean(disabled));
-
- if (!manualInput || disabled){
- variables.setVariable("color", "color: gray;");
- }
- else{
- variables.setVariable("color", "");
- }
-
- variables.setVariable("inputSize",
component.getAttributes().get("inputSize"));
- variables.setVariable("style",component.getStyleValue());
-
- ]]></jsp:scriptlet>
-
- <table id="#{clientId}" border="0" cellpadding="0"
cellspacing="0" class="dr-insldr rich-slider
#{component.attributes['styleClass']}"
+ <table id="#{clientId}" border="0" cellpadding="0"
cellspacing="0" class="dr-insldr rich-slider
#{component.attributes['styleClass']}"
style="#{style}"
x:passThruWithExclusions="id,boundClass,tipClass,class,width,height,style,border">
<tbody>
<tr>
<jsp:scriptlet><![CDATA[
- if ("left".equalsIgnoreCase(inputPosition)) {
+ if
("left".equalsIgnoreCase((String)variables.getVariable("inputPosition")))
{
]]></jsp:scriptlet>
<td rowspan="2" style="text-align: right;
vertical-align: bottom">
<jsp:scriptlet><![CDATA[
- if (showInput) {
+ if
(((Boolean)variables.getVariable("showInput")).booleanValue()) {
]]></jsp:scriptlet>
<input id="#{clientId}Input"
name="#{clientId}"
@@ -101,11 +81,11 @@
</td>
<jsp:scriptlet><![CDATA[
- if ("right".equalsIgnoreCase(inputPosition)) {
+ if
("right".equalsIgnoreCase((String)variables.getVariable("inputPosition")))
{
]]></jsp:scriptlet>
<td rowspan="2" style="text-align: left;
vertical-align: bottom">
<jsp:scriptlet><![CDATA[
- if (showInput) {
+ if (((Boolean)variables.getVariable("showInput")).booleanValue()) {
]]></jsp:scriptlet>
<input id="#{clientId}Input"
name="#{clientId}"