Author: A.Skokov
Date: 2007-07-31 06:41:40 -0400 (Tue, 31 Jul 2007)
New Revision: 1945
Modified:
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
Log:
http://jira.jboss.com/jira/browse/RF-490
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 2007-07-31
09:50:46 UTC (rev 1944)
+++
trunk/ui/inputnumber-slider/src/main/java/org/richfaces/renderkit/InputNumberSliderRendererBase.java 2007-07-31
10:41:40 UTC (rev 1945)
@@ -29,7 +29,7 @@
/**
* @author Nick - mailto:nbelaevski@exadel.com
* created 19.01.2007
- *
+ *
*/
public class InputNumberSliderRendererBase extends InputRendererBase {
@@ -40,9 +40,4 @@
protected boolean attributeToBoolean(UIComponent component, String attributeName) {
return getUtils().isBooleanAttribute(component, attributeName);
}
-
- public String writeSpace() {
- return " ";
- }
-
}
Modified:
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
---
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-31
09:50:46 UTC (rev 1944)
+++
trunk/ui/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-07-31
10:41:40 UTC (rev 1945)
@@ -86,12 +86,13 @@
Event.observe(this.input, "change", this.eventInputChange);
}
this.initialized = true;
- Event.observe(window, "load",
this.setInitialValue.bindAsEventListener(this)); //FIX RFA-190
- //Event.observe($(input), "propertychange",
this.setInitialValue.bindAsEventListener(this));
+ this.setInitialValue();
+ //Event.observe(window, "load",
this.setInitialValue.bindAsEventListener(this)); //FIX RFA-190
+ //Event.observe($(input), "propertychange",
this.setInitialValue.bindAsEventListener(this));
this.required = options.required;
},
-
+
setInitialValue: function(){
this.setValue(parseFloat(this.options.sliderValue || this.range.start));
this.handle.style.visibility="visible";
@@ -114,9 +115,9 @@
},
roundFloat: function(x){
- if (!this.digCount)
+ if (!this.digCount)
return Math.round(x);
-
+
return parseFloat(Number(x).toFixed(this.digCount));
},
@@ -163,7 +164,7 @@
if (t <= v[k]) j = k;
else i = k + 1;
}
-
+
return i;
},
@@ -215,10 +216,10 @@
if(Event.isLeftClick(event)) {
if(!this.disabled){
- this.handle.className = this.classes.arrowSelected + this.classes.base +
this.classes.handleSelected;
+ this.handle.className = this.classes.arrowSelected + this.classes.base +
this.classes.handleSelected;
if (this.options.currValue){
this.tip.style.display = "block";
- }
+ }
Richfaces.createEvent("mousedown", this.mainTable, null, null).fire();
this.active = true;
var handle = Event.element(event);
@@ -234,7 +235,7 @@
update: function(event) {
if(this.active) {
-
+
if(!this.dragging) this.dragging = true;
this.draw(event);
Event.stop(event);
@@ -247,7 +248,7 @@
pointer -= this.offsetX + offsets[0];
this.setValue(this.translateToValue( pointer ));
},
-
+
processMouseUp: function(event) {
this.endDrag(event);
this.fireClickIfNeeded(event);
@@ -262,27 +263,27 @@
if (this.eventChanged && this.isValueChanged()){
this.eventChanged(event);
}
- this.handle.className = this.classes.arrow + this.classes.base;
+ this.handle.className = this.classes.arrow + this.classes.base;
if(this.active && this.dragging) {
this.active = false;
- this.dragging = false;
+ this.dragging = false;
Richfaces.createEvent("mouseup", this.mainTable, null, null).fire();
Event.stop(event);
}
if (RichFaces.navigatorType() != "MSIE")
Richfaces.createEvent("change", this.input, null, null).fire();
},
-
- fireClickIfNeeded: function(event){
- if ((this.prevMouseDownEvent.target != event.target
+
+ fireClickIfNeeded: function(event){
+ if ((this.prevMouseDownEvent.target != event.target
&& RichFaces.navigatorType() == "FF")
- || (RichFaces.getOperaVersion()
- && RichFaces.getOperaVersion() < 9.0
- && event.target.tagName.toLowerCase() != "div")) {
+ || (RichFaces.getOperaVersion()
+ && RichFaces.getOperaVersion() < 9.0
+ && event.target.tagName.toLowerCase() != "div")) {
Richfaces.createEvent("click", this.mainTable, null, null).fire();
}
},
-
+
isValueChanged : function(){
var ret =this.prevValue != this.value
this.prevValue = this.value;
Modified: trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx
===================================================================
--- trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-31
09:50:46 UTC (rev 1944)
+++ trunk/ui/inputnumber-slider/src/main/templates/inputNumberSlider.jspx 2007-07-31
10:41:40 UTC (rev 1945)
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
-<f:root
-
xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c="
http://java.sun.com/jsf/core"
+<f:root
+
xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c="
http://java.sun.com/jsf/core"
xmlns:ui="
http://ajax4jsf.org/cdk/ui"
xmlns:u="
http://ajax4jsf.org/cdk/u"
xmlns:x="
http://ajax4jsf.org/cdk/x"
class="org.richfaces.renderkit.html.InputNumberSliderRenderer"
baseclass="org.richfaces.renderkit.InputNumberSliderRendererBase"
- component="org.richfaces.component.UIInputNumberSlider"
+ component="org.richfaces.component.UIInputNumberSlider"
<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: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" />
@@ -23,21 +23,21 @@
<tr>
<td class="dr-insldr-left-num rich-inslider-left-num
#{component.attributes['boundClass']}">
<jsp:scriptlet><![CDATA[
- if (attributeToBoolean(component, "showBoundaryValues")){
- ]]></jsp:scriptlet>
+ if (attributeToBoolean(component, "showBoundaryValues")){
+ ]]></jsp:scriptlet>
#{component.attributes['minValue']}
<jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
+ }
+ ]]></jsp:scriptlet>
</td>
<td class="dr-insldr-right-num rich-inslider-right-num
#{component.attributes['boundClass']}">
<jsp:scriptlet><![CDATA[
- if (attributeToBoolean(component, "showBoundaryValues")){
- ]]></jsp:scriptlet>
+ if (attributeToBoolean(component, "showBoundaryValues")){
+ ]]></jsp:scriptlet>
#{component.attributes['maxValue']}
<jsp:scriptlet><![CDATA[
- }
- ]]></jsp:scriptlet>
+ }
+ ]]></jsp:scriptlet>
</td>
<td rowspan="2" style="vertical-align : bottom">
<jsp:scriptlet><![CDATA[
@@ -49,14 +49,14 @@
variables.setVariable("inputDisabled",new Boolean(disabled));
if (!manualInput || disabled){
- variables.setVariable("color", "color: gray;");
+ variables.setVariable("color", "color: gray;");
}
else{
- variables.setVariable("color", "");
+ variables.setVariable("color", "");
}
-
+
variables.setVariable("inputSize",
component.getAttributes().get("inputSize"));
-
+
//if (showInput || manualInput) {
if (showInput) {
]]></jsp:scriptlet>
@@ -64,7 +64,7 @@
name="#{clientId}"
value="#{this:getInputValue(context,component)}"
type="text"
- class="dr-insldr-field rich-inslider-field
#{component.attributes['inputClass']}"
+ class="dr-insldr-field rich-inslider-field
#{component.attributes['inputClass']}"
style="#{component.attributes['inputStyle']}; #{color}"
readonly="#{inputReadOnly}"
disabled="#{disabled}"
@@ -74,7 +74,7 @@
accesskey="#{component.attributes['accesskey']}"
size="#{inputSize}"
maxlength="#{component.attributes['maxlength']}"
- />
+ />
<jsp:scriptlet><![CDATA[
} else {
]]></jsp:scriptlet>
@@ -82,7 +82,7 @@
name="#{clientId}"
value="#{this:getInputValue(context,component)}"
type="hidden"
- />
+ />
<jsp:scriptlet><![CDATA[
}
]]></jsp:scriptlet>
@@ -96,9 +96,15 @@
<td id="#{clientId}Track">
<div style="position : relative">
<div id="#{clientId}Tip" class="dr-insldr-tip
rich-inslider-tip #{component.attributes['tipClass']}" style="display:
none;#{component.attributes['tipStyle']}">
- #{this:writeSpace()}</div>
+ <jsp:scriptlet><![CDATA[
+ writer.write(" ");
+ ]]></jsp:scriptlet>
+ </div>
<div class="dr-insldr-handler rich-inslider-handler
#{component.attributes['handleClass']}" id="#{clientId}Handle">
- #{this:writeSpace()}</div>
+ <jsp:scriptlet><![CDATA[
+ writer.write(" ");
+ ]]></jsp:scriptlet>
+ </div>
</div>
<div class="dr-insldr-track rich-inslider-track
#{component.attributes['barClass']}"
style="#{component.attributes['barStyle']}">
<table class="dr-insldr-track-decor-1" cellpadding="0"
cellspacing="0">
@@ -111,13 +117,13 @@
</tbody>
</table>
</div>
- <script type="text/javascript">
+ <script type="text/javascript">
new Exadel.Slider(
- "#{clientId}Handle",
+ "#{clientId}Handle",
"#{clientId}Track",
"#{clientId}Tip",
"#{clientId}",
- "#{component.attributes['handleSelectedClass']}",
+ "#{component.attributes['handleSelectedClass']}",
{
range :
$R(#{component.attributes['minValue']},#{component.attributes['maxValue']}),
step : "#{component.attributes['step']}",
@@ -127,7 +133,7 @@
inputId : "#{clientId}Input",
arrowSelected : "#{arrowSelected}",
onerr : "#{component.attributes['onerror']}",
- onchange : "#{component.attributes['onchange']}",
+ onchange : "#{component.attributes['onchange']}",
required : #{component.attributes['required']}
})
</script>