Author: dmorozov
Date: 2008-09-03 06:53:40 -0400 (Wed, 03 Sep 2008)
New Revision: 10291
Modified:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/datafilterslider.js
Log:
https://jira.jboss.org/jira/browse/RF-4322
and bug
https://jira.jboss.org/jira/browse/RF-4053
Modified:
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java
===================================================================
---
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2008-09-03
09:51:44 UTC (rev 10290)
+++
trunk/ui/dataFilterSlider/src/main/java/org/richfaces/renderkit/DataFilterSliderRendererBase.java 2008-09-03
10:53:40 UTC (rev 10291)
@@ -31,6 +31,7 @@
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
+import org.ajax4jsf.context.AjaxContext;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
@@ -71,7 +72,7 @@
}
public String renderSliderJs1(FacesContext context, UIDataFltrSlider slider) throws
IOException {
-
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
StringBuffer script = new StringBuffer();
String clientId = slider.getClientId(context);
script.append("var dataFilterSlider = ");
@@ -83,6 +84,7 @@
options.append(",values: [" + slider.getSliderRange() + "]");
options.append(",startSpan: '"+ clientId
+"slider-trailer'");
options.append(",sliderInputId: '" + clientId +
"slider_val'");
+ options.append(",isAjax: " + ajaxContext.isAjaxRequest());
options.append(",sliderValue:$('"+ clientId
+"slider_val').value");
String onslide = getEventHandlerFunction(slider, "onslide");
Modified:
trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/datafilterslider.js
===================================================================
---
trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/datafilterslider.js 2008-09-03
09:51:44 UTC (rev 10290)
+++
trunk/ui/dataFilterSlider/src/main/resources/org/richfaces/renderkit/html/scripts/datafilterslider.js 2008-09-03
10:53:40 UTC (rev 10291)
@@ -11,10 +11,6 @@
Richfaces.DFSControl = {};
Richfaces.DFSControl.Slider = Class.create();
-if (!window.RichShuttleUtils) {
- window.RichShuttleUtils = {};
-}
-
Richfaces.DFSControl.execOnLoad = function(func, condition, timeout) {
if (condition()) {
@@ -97,16 +93,24 @@
// Initialize handles in reverse (make sure first handle is active)
this.handles[0].style.visibility="hidden";
- Richfaces.DFSControl.execOnLoad(
- function() {
- this.initHandles();
- }.bind(this),
- function() {
- return this.handles[0].offsetHeight > 0;
- }.bind(this),
- 100);
-
- //Event.observe(window, "load", this.loadEventHandler);
+ // This is workaround for bug
+ //
https://jira.jboss.org/jira/browse/RF-4322 and bug
+ //
https://jira.jboss.org/jira/browse/RF-4053
+ // Safari load css style files too slow, so when full page loaded and DOM already
calculated,
+ // can be happened that not all style classes applied to elements
+ if (this.options.isAjax) {
+ Richfaces.DFSControl.execOnLoad(
+ function() {
+ this.initHandles();
+ }.bind(this),
+ function() {
+ return this.handles && this.handles.length > 0 &&
this.handles[0].offsetHeight > 0;
+ }.bind(this),
+ 100);
+ } else {
+ Event.observe(window, "load", this.loadEventHandler);
+ }
+
this.initialized = true;
},
@@ -123,7 +127,7 @@
slider.setValue(parseFloat(
(slider.options.sliderValue instanceof Array ?
slider.options.sliderValue[i] : slider.options.sliderValue) ||
- slider.range.start), i);
+ slider.range.start), i);
Element.makePositioned(h); // fix IE
Event.observe(h, "mousedown", slider.eventMouseDown);
});