JBoss Rich Faces SVN: r3946 - trunk/ui/calendar/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2007-11-13 10:47:46 -0500 (Tue, 13 Nov 2007)
New Revision: 3946
Modified:
trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
Log:
RF-1295 partially
Modified: trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-11-13 14:16:39 UTC (rev 3945)
+++ trunk/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-11-13 15:47:46 UTC (rev 3946)
@@ -30,6 +30,7 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.TimeZone;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -453,7 +454,8 @@
}
if (date != null) {
- return ScriptUtils.toScript(formatDate(date));
+ return ScriptUtils.toScript(formatSelectedDate(date));
+ //TODO KAA Add ServerTime Processing;
}
return ScriptUtils.toScript(null);
@@ -469,5 +471,17 @@
return result;
}
-
+
+ public static Object formatSelectedDate(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ JSFunction result = new JSFunction("new Date");
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MINUTE)));
+ result.addParameter(new Integer(0));
+ return result;
+ }
}
18 years, 5 months
JBoss Rich Faces SVN: r3945 - management/design/contextMenu.
by richfaces-svn-commits@lists.jboss.org
Author: smukhina
Date: 2007-11-13 09:16:39 -0500 (Tue, 13 Nov 2007)
New Revision: 3945
Modified:
management/design/contextMenu/FuncSpec - Context Menu.doc
Log:
http://jira.jboss.com/jira/browse/RF-1297
context menu spec
for details look revisions section
+ language is corrected
Modified: management/design/contextMenu/FuncSpec - Context Menu.doc
===================================================================
(Binary files differ)
18 years, 5 months
JBoss Rich Faces SVN: r3944 - in trunk/ui/dropdown-menu/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2007-11-13 07:46:18 -0500 (Tue, 13 Nov 2007)
New Revision: 3944
Modified:
trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
trunk/ui/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
Log:
Fixed wrong script invocation
Modified: trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java
===================================================================
--- trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-11-13 11:07:32 UTC (rev 3943)
+++ trunk/ui/dropdown-menu/src/main/java/org/richfaces/renderkit/html/DropDownMenuRendererBase.java 2007-11-13 12:46:18 UTC (rev 3944)
@@ -72,11 +72,11 @@
} else {
buffer.append(".");
- function = new JSFunction("asContextMenu");
+ function = new JSFunction("asDropDown");
function.addParameter(component.getClientId(context));
String evt = (String) component.getAttributes().get("event");
if(evt == null || evt.trim().length() == 0){
- evt = "oncontextmenu";
+ evt = "onmouseover";
}
function.addParameter(evt);
function.addParameter("onmouseout");
Modified: trunk/ui/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js
===================================================================
--- trunk/ui/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-11-13 11:07:32 UTC (rev 3943)
+++ trunk/ui/dropdown-menu/src/main/resources/org/richfaces/renderkit/html/scripts/menu.js 2007-11-13 12:46:18 UTC (rev 3944)
@@ -146,7 +146,7 @@
shutdown: function () {
var needToResetLayers = false;
- for (i=0; i<this.listl.length; i++) {
+ for (var i=0; i<this.listl.length; i++) {
var layerId = this.listl[i];
if ($(layerId)) {
this.LMPopUpL(layerId, false);
18 years, 5 months
JBoss Rich Faces SVN: r3943 - trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-11-13 06:07:32 -0500 (Tue, 13 Nov 2007)
New Revision: 3943
Added:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js
Log:
partial RF-1194
Added: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js (rev 0)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js 2007-11-13 11:07:32 UTC (rev 3943)
@@ -0,0 +1,865 @@
+/**
+ * jCarousel - Riding carousels with jQuery
+ * http://sorgalla.com/jcarousel/
+ *
+ * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * Built on top of the jQuery library
+ * http://jquery.com
+ *
+ * Inspired by the "Carousel Component" by Bill Scott
+ * http://billwscott.com/carousel/
+ */
+
+(function($) {
+ /**
+ * Creates a carousel for all matched elements.
+ *
+ * @example $("#mycarousel").jcarousel();
+ * @before <ul id="mycarousel"><li>First item</li><li>Second item</li></ul>
+ * @result
+ *
+ * <div class="jcarousel-skin-name jcarousel-container">
+ * <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
+ * <div class="jcarousel-next"></div>
+ * <div class="jcarousel-clip">
+ * <ul class="jcarousel-list">
+ * <li class="jcarousel-item-1">First item</li>
+ * <li class="jcarousel-item-2">Second item</li>
+ * </ul>
+ * </div>
+ * </div>
+ *
+ * @name jcarousel
+ * @type jQuery
+ * @param Hash o A set of key/value pairs to set as configuration properties.
+ * @cat Plugins/jCarousel
+ */
+ $.fn.jcarousel = function(o) {
+ return this.each(function() {
+ new $jc(this, o);
+ });
+ };
+
+ // Default configuration properties.
+ var defaults = {
+ vertical: false,
+ start: 1,
+ offset: 1,
+ size: null,
+ scroll: 3,
+ visible: null,
+ animation: 'normal',
+ easing: 'swing',
+ auto: 0,
+ wrap: null,
+ initCallback: null,
+ reloadCallback: null,
+ itemLoadCallback: null,
+ itemFirstInCallback: null,
+ itemFirstOutCallback: null,
+ itemLastInCallback: null,
+ itemLastOutCallback: null,
+ itemVisibleInCallback: null,
+ itemVisibleOutCallback: null,
+ buttonNextHTML: '<div></div>',
+ buttonPrevHTML: '<div></div>',
+ buttonNextEvent: 'click',
+ buttonPrevEvent: 'click',
+ buttonNextCallback: null,
+ buttonPrevCallback: null
+ };
+
+ /**
+ * The jCarousel object.
+ *
+ * @constructor
+ * @name $.jcarousel
+ * @param Object e The element to create the carousel for.
+ * @param Hash o A set of key/value pairs to set as configuration properties.
+ * @cat Plugins/jCarousel
+ */
+ $.jcarousel = function(e, o) {
+ this.options = $.extend({}, defaults, o || {});
+
+ this.locked = false;
+
+ this.container = null;
+ this.clip = null;
+ this.list = null;
+ this.buttonNext = null;
+ this.buttonPrev = null;
+
+ this.wh = !this.options.vertical ? 'width' : 'height';
+ this.lt = !this.options.vertical ? 'left' : 'top';
+
+ if (e.nodeName == 'UL' || e.nodeName == 'OL') {
+ this.list = $(e);
+ this.container = this.list.parent();
+
+ if ($.className.has(this.container[0].className, 'jcarousel-clip')) {
+ if (!$.className.has(this.container[0].parentNode.className, 'jcarousel-container'))
+ this.container = this.container.wrap('<div></div>');
+
+ this.container = this.container.parent();
+ } else if (!$.className.has(this.container[0].className, 'jcarousel-container'))
+ this.container = this.list.wrap('<div></div>').parent();
+
+ // Move skin class over to container
+ var split = e.className.split(' ');
+
+ for (var i = 0; i < split.length; i++) {
+ if (split[i].indexOf('jcarousel-skin') != -1) {
+ this.list.removeClass(split[i]);
+ this.container.addClass(split[i]);
+ break;
+ }
+ }
+ } else {
+ this.container = $(e);
+ this.list = $(e).children('ul,ol');
+ }
+
+ this.clip = this.list.parent();
+
+ if (!this.clip.length || !$.className.has(this.clip[0].className, 'jcarousel-clip'))
+ this.clip = this.list.wrap('<div></div>').parent();
+
+ this.buttonPrev = $('.jcarousel-prev', this.container);
+
+ if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
+ this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();
+
+ this.buttonPrev.addClass(this.className('jcarousel-prev'));
+
+ this.buttonNext = $('.jcarousel-next', this.container);
+
+ if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
+ this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();
+
+ this.buttonNext.addClass(this.className('jcarousel-next'));
+
+ this.clip.addClass(this.className('jcarousel-clip'));
+ this.list.addClass(this.className('jcarousel-list'));
+ this.container.addClass(this.className('jcarousel-container'));
+
+ var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
+ var li = this.list.children('li');
+
+ var self = this;
+
+ if (li.size() > 0) {
+ var wh = 0, i = this.options.offset;
+ li.each(function() {
+ self.format(this, i++);
+ wh += self.dimension(this, di);
+ });
+
+ this.list.css(this.wh, wh + 'px');
+
+ // Only set if not explicitly passed as option
+ if (!o || o.size == undefined)
+ this.options.size = li.size();
+ }
+
+ // For whatever reason, .show() does not work in Safari...
+ this.container.css('display', 'block');
+ this.buttonNext.css('display', 'block');
+ this.buttonPrev.css('display', 'block');
+
+ this.funcNext = function() { self.next(); };
+ this.funcPrev = function() { self.prev(); };
+
+ $(window).bind('resize', function() { self.reload(); });
+
+ if (this.options.initCallback != null)
+ this.options.initCallback(this, 'init');
+
+ this.setup();
+ };
+
+ // Create shortcut for internal use
+ var $jc = $.jcarousel;
+
+ $jc.fn = $jc.prototype = {
+ jcarousel: '0.2.2'
+ };
+
+ $jc.fn.extend = $jc.extend = $.extend;
+
+ $jc.fn.extend({
+ /**
+ * Setups the carousel.
+ *
+ * @name setup
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ setup: function() {
+ this.first = null;
+ this.last = null;
+ this.prevFirst = null;
+ this.prevLast = null;
+ this.animating = false;
+ this.timer = null;
+ this.tail = null;
+ this.inTail = false;
+
+ if (this.locked)
+ return;
+
+ this.list.css(this.lt, this.pos(this.options.offset) + 'px');
+ var p = this.pos(this.options.start);
+ this.prevFirst = this.prevLast = null;
+ this.animate(p, false);
+ },
+
+ /**
+ * Clears the list and resets the carousel.
+ *
+ * @name reset
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ reset: function() {
+ this.list.empty();
+
+ this.list.css(this.lt, '0px');
+ this.list.css(this.wh, '0px');
+
+ if (this.options.initCallback != null)
+ this.options.initCallback(this, 'reset');
+
+ this.setup();
+ },
+
+ /**
+ * Reloads the carousel and adjusts positions.
+ *
+ * @name reload
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ reload: function() {
+ if (this.tail != null && this.inTail)
+ this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
+
+ this.tail = null;
+ this.inTail = false;
+
+ if (this.options.reloadCallback != null)
+ this.options.reloadCallback(this);
+
+ if (this.options.visible != null) {
+ var self = this;
+ var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
+ $('li', this.list).each(function(i) {
+ wh += self.dimension(this, di);
+ if (i + 1 < self.first)
+ lt = wh;
+ });
+
+ this.list.css(this.wh, wh + 'px');
+ this.list.css(this.lt, -lt + 'px');
+ }
+
+ this.scroll(this.first, false);
+ },
+
+ /**
+ * Locks the carousel.
+ *
+ * @name lock
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ lock: function() {
+ this.locked = true;
+ this.buttons();
+ },
+
+ /**
+ * Unlocks the carousel.
+ *
+ * @name unlock
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ unlock: function() {
+ this.locked = false;
+ this.buttons();
+ },
+
+ /**
+ * Sets the size of the carousel.
+ *
+ * @name size
+ * @type undefined
+ * @param Number s The size of the carousel.
+ * @cat Plugins/jCarousel
+ */
+ size: function(s) {
+ if (s != undefined) {
+ this.options.size = s;
+ if (!this.locked)
+ this.buttons();
+ }
+
+ return this.options.size;
+ },
+
+ /**
+ * Checks whether a list element exists for the given index (or index range).
+ *
+ * @name get
+ * @type bool
+ * @param Number i The index of the (first) element.
+ * @param Number i2 The index of the last element.
+ * @cat Plugins/jCarousel
+ */
+ has: function(i, i2) {
+ if (i2 == undefined || !i2)
+ i2 = i;
+
+ for (var j = i; j <= i2; j++) {
+ var e = this.get(j).get(0);
+ if (!e || $.className.has(e, 'jcarousel-item-placeholder'))
+ return false;
+ }
+
+ return true;
+ },
+
+ /**
+ * Returns a jQuery object with list element for the given index.
+ *
+ * @name get
+ * @type jQuery
+ * @param Number i The index of the element.
+ * @cat Plugins/jCarousel
+ */
+ get: function(i) {
+ return $('.jcarousel-item-' + i, this.list);
+ },
+
+ /**
+ * Adds an element for the given index to the list.
+ * If the element already exists, it updates the inner html.
+ * Returns the created element as jQuery object.
+ *
+ * @name add
+ * @type jQuery
+ * @param Number i The index of the element.
+ * @param String s The innerHTML of the element.
+ * @cat Plugins/jCarousel
+ */
+ add: function(i, s) {
+ var e = this.get(i), old = 0;
+
+ if (e.length == 0) {
+ var c, e = this.create(i), j = $jc.intval(i);
+ while (c = this.get(--j)) {
+ if (j <= 0 || c.length) {
+ j <= 0 ? this.list.prepend(e) : c.after(e);
+ break;
+ }
+ }
+ } else
+ old = this.dimension(e);
+
+ e.removeClass(this.className('jcarousel-item-placeholder'));
+ typeof s == 'string' ? e.html(s) : e.empty().append(s);
+
+ var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
+ var wh = this.dimension(e, di) - old;
+
+ if (i > 0 && i < this.first)
+ this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + wh + 'px');
+
+ this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
+
+ return e;
+ },
+
+ /**
+ * Removes an element for the given index from the list.
+ *
+ * @name remove
+ * @type undefined
+ * @param Number i The index of the element.
+ * @cat Plugins/jCarousel
+ */
+ remove: function(i) {
+ var e = this.get(i);
+
+ // Check if item exists and is not currently visible
+ if (!e.length || (i >= this.first && i <= this.last))
+ return;
+
+ var d = this.dimension(e);
+
+ if (i < this.first)
+ this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
+
+ e.remove();
+
+ this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
+ },
+
+ /**
+ * Moves the carousel forwards.
+ *
+ * @name next
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ next: function() {
+ this.stopAuto();
+
+ if (this.tail != null && !this.inTail)
+ this.scrollTail(false);
+ else
+ this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
+ },
+
+ /**
+ * Moves the carousel backwards.
+ *
+ * @name prev
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ prev: function() {
+ this.stopAuto();
+
+ if (this.tail != null && this.inTail)
+ this.scrollTail(true);
+ else
+ this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
+ },
+
+ /**
+ * Scrolls the tail of the carousel.
+ *
+ * @name scrollTail
+ * @type undefined
+ * @param Bool b Whether scroll the tail back or forward.
+ * @cat Plugins/jCarousel
+ */
+ scrollTail: function(b) {
+ if (this.locked || this.animating || !this.tail)
+ return;
+
+ var pos = $jc.intval(this.list.css(this.lt));
+
+ !b ? pos -= this.tail : pos += this.tail;
+ this.inTail = !b;
+
+ // Save for callbacks
+ this.prevFirst = this.first;
+ this.prevLast = this.last;
+
+ this.animate(pos);
+ },
+
+ /**
+ * Scrolls the carousel to a certain position.
+ *
+ * @name scroll
+ * @type undefined
+ * @param Number i The index of the element to scoll to.
+ * @param Bool a Flag indicating whether to perform animation.
+ * @cat Plugins/jCarousel
+ */
+ scroll: function(i, a) {
+ if (this.locked || this.animating)
+ return;
+
+ this.animate(this.pos(i), a);
+ },
+
+ /**
+ * Prepares the carousel and return the position for a certian index.
+ *
+ * @name pos
+ * @type Number
+ * @param Number i The index of the element to scoll to.
+ * @cat Plugins/jCarousel
+ */
+ pos: function(i) {
+ if (this.locked || this.animating)
+ return;
+
+ if (this.options.wrap != 'circular')
+ i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
+
+ var back = this.first > i;
+ var pos = $jc.intval(this.list.css(this.lt));
+
+ // Create placeholders, new list width/height
+ // and new list position
+ var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
+ var c = back ? this.get(f) : this.get(this.last);
+ var j = back ? f : f - 1;
+ var e = null, l = 0, p = false, d = 0;
+
+ while (back ? --j >= i : ++j < i) {
+ e = this.get(j);
+ p = !e.length;
+ if (e.length == 0) {
+ e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
+ c[back ? 'before' : 'after' ](e);
+ }
+
+ c = e;
+ d = this.dimension(e);
+
+ if (p)
+ l += d;
+
+ if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
+ pos = back ? pos + d : pos - d;
+ }
+
+ // Calculate visible items
+ var clipping = this.clipping();
+ var cache = [];
+ var visible = 0, j = i, v = 0;
+ var c = this.get(i - 1);
+
+ while (++visible) {
+ e = this.get(j);
+ p = !e.length;
+ if (e.length == 0) {
+ e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
+ // This should only happen on a next scroll
+ c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
+ }
+
+ c = e;
+ var d = this.dimension(e);
+
+ if (d == 0) {
+ alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
+ return 0;
+ }
+
+ if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
+ cache.push(e);
+ else if (p)
+ l += d;
+
+ v += d;
+
+ if (v >= clipping)
+ break;
+
+ j++;
+ }
+
+ // Remove out-of-range placeholders
+ for (var x = 0; x < cache.length; x++)
+ cache[x].remove();
+
+ // Resize list
+ if (l > 0) {
+ this.list.css(this.wh, this.dimension(this.list) + l + 'px');
+
+ if (back) {
+ pos -= l;
+ this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
+ }
+ }
+
+ // Calculate first and last item
+ var last = i + visible - 1;
+ if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
+ last = this.options.size;
+
+ if (j > last) {
+ visible = 0, j = last, v = 0;
+ while (++visible) {
+ var e = this.get(j--);
+ if (!e.length)
+ break;
+ v += this.dimension(e);
+ if (v >= clipping)
+ break;
+ }
+ }
+
+ var first = last - visible + 1;
+ if (this.options.wrap != 'circular' && first < 1)
+ first = 1;
+
+ if (this.inTail && back) {
+ pos += this.tail;
+ this.inTail = false;
+ }
+
+ this.tail = null;
+ if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
+ var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
+ if ((v - m) > clipping)
+ this.tail = v - clipping - m;
+ }
+
+ // Adjust position
+ while (i-- > first)
+ pos += this.dimension(this.get(i));
+
+ // Save visible item range
+ this.prevFirst = this.first;
+ this.prevLast = this.last;
+ this.first = first;
+ this.last = last;
+
+ return pos;
+ },
+
+ /**
+ * Animates the carousel to a certain position.
+ *
+ * @name animate
+ * @type undefined
+ * @param mixed p Position to scroll to.
+ * @param Bool a Flag indicating whether to perform animation.
+ * @cat Plugins/jCarousel
+ */
+ animate: function(p, a) {
+ if (this.locked || this.animating)
+ return;
+
+ this.animating = true;
+
+ var self = this;
+ var scrolled = function() {
+ self.animating = false;
+
+ if (p == 0)
+ self.list.css(self.lt, 0);
+
+ if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
+ self.startAuto();
+
+ self.buttons();
+ self.notify('onAfterAnimation');
+ };
+
+ this.notify('onBeforeAnimation');
+
+ // Animate
+ if (!this.options.animation || a == false) {
+ this.list.css(this.lt, p + 'px');
+ scrolled();
+ } else {
+ var o = !this.options.vertical ? {'left': p} : {'top': p};
+ this.list.animate(o, this.options.animation, this.options.easing, scrolled);
+ }
+ },
+
+ /**
+ * Starts autoscrolling.
+ *
+ * @name auto
+ * @type undefined
+ * @param Number s Seconds to periodically autoscroll the content.
+ * @cat Plugins/jCarousel
+ */
+ startAuto: function(s) {
+ if (s != undefined)
+ this.options.auto = s;
+
+ if (this.options.auto == 0)
+ return this.stopAuto();
+
+ if (this.timer != null)
+ return;
+
+ var self = this;
+ this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
+ },
+
+ /**
+ * Stops autoscrolling.
+ *
+ * @name stopAuto
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ stopAuto: function() {
+ if (this.timer == null)
+ return;
+
+ clearTimeout(this.timer);
+ this.timer = null;
+ },
+
+ /**
+ * Sets the states of the prev/next buttons.
+ *
+ * @name buttons
+ * @type undefined
+ * @cat Plugins/jCarousel
+ */
+ buttons: function(n, p) {
+ if (n == undefined || n == null) {
+ var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
+ if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
+ n = this.tail != null && !this.inTail;
+ }
+
+ if (p == undefined || p == null) {
+ var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
+ if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
+ p = this.tail != null && this.inTail;
+ }
+
+ var self = this;
+
+ this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
+ this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
+
+ if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
+ this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
+ this.buttonNext[0].jcarouselstate = n;
+ }
+
+ if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
+ this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
+ this.buttonPrev[0].jcarouselstate = p;
+ }
+ },
+
+ notify: function(evt) {
+ var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
+
+ // Load items
+ this.callback('itemLoadCallback', evt, state);
+
+ if (this.prevFirst != this.first) {
+ this.callback('itemFirstInCallback', evt, state, this.first);
+ this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
+ }
+
+ if (this.prevLast != this.last) {
+ this.callback('itemLastInCallback', evt, state, this.last);
+ this.callback('itemLastOutCallback', evt, state, this.prevLast);
+ }
+
+ this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
+ this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
+ },
+
+ callback: function(cb, evt, state, i1, i2, i3, i4) {
+ if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
+ return;
+
+ var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
+
+ if (!$.isFunction(callback))
+ return;
+
+ var self = this;
+
+ if (i1 === undefined)
+ callback(self, state, evt);
+ else if (i2 === undefined)
+ this.get(i1).each(function() { callback(self, this, i1, state, evt); });
+ else {
+ for (var i = i1; i <= i2; i++)
+ if (!(i >= i3 && i <= i4))
+ this.get(i).each(function() { callback(self, this, i, state, evt); });
+ }
+ },
+
+ create: function(i) {
+ return this.format('<li></li>', i);
+ },
+
+ format: function(e, i) {
+ var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i));
+ $e.attr('jcarouselindex', i);
+ return $e;
+ },
+
+ className: function(c) {
+ return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
+ },
+
+ dimension: function(e, d) {
+ var el = e.jquery != undefined ? e[0] : e;
+
+ var old = !this.options.vertical ?
+ el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
+ el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');
+
+ if (d == undefined || old == d)
+ return old;
+
+ var w = !this.options.vertical ?
+ d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
+ d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');
+
+ $(el).css(this.wh, w + 'px');
+
+ return this.dimension(el);
+ },
+
+ clipping: function() {
+ return !this.options.vertical ?
+ this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
+ this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
+ },
+
+ index: function(i, s) {
+ if (s == undefined)
+ s = this.options.size;
+
+ return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
+ }
+ });
+
+ $jc.extend({
+ /**
+ * Sets the global default configuration properties.
+ *
+ * @name defaults
+ * @descr Sets the global default configuration properties.
+ * @type undefined
+ * @param Hash d A set of key/value pairs to set as configuration properties.
+ * @cat Plugins/jCarousel
+ */
+ defaults: function(d) {
+ $.extend(defaults, d);
+ },
+
+ margin: function(e, p) {
+ if (!e)
+ return 0;
+
+ var el = e.jquery != undefined ? e[0] : e;
+
+ if (p == 'marginRight' && $.browser.safari) {
+ var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;
+
+ $.swap(el, old, function() { oWidth = el.offsetWidth; });
+
+ old['marginRight'] = 0;
+ $.swap(el, old, function() { oWidth2 = el.offsetWidth; });
+
+ return oWidth2 - oWidth;
+ }
+
+ return $jc.intval($.css(el, p));
+ },
+
+ intval: function(v) {
+ v = parseInt(v);
+ return isNaN(v) ? 0 : v;
+ }
+ });
+
+})(jQuery);
18 years, 5 months
JBoss Rich Faces SVN: r3942 - in trunk: samples/calendar-sample/src/main/webapp/pages and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2007-11-13 06:06:27 -0500 (Tue, 13 Nov 2007)
New Revision: 3942
Modified:
trunk/framework/impl/generatescript.xml
trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
partial RF-1194
Modified: trunk/framework/impl/generatescript.xml
===================================================================
--- trunk/framework/impl/generatescript.xml 2007-11-13 10:53:18 UTC (rev 3941)
+++ trunk/framework/impl/generatescript.xml 2007-11-13 11:06:27 UTC (rev 3942)
@@ -53,14 +53,13 @@
files="jquery-1.2.1.js,noConflict.js,identity.js">
</filelist>
-
<filelist id="scriptaculous"
dir="${basedir}/src/main/javascript/scriptaculous"
files="builder.js,effects.js,dragdrop.js,controls.js,slider.js,sound.js" >
</filelist>
- <filelist id="prototype"
+ <filelist id="prototype"
dir="${basedir}/src/main/javascript/prototype"
files="prototype1.5.1.1.js,patches.js">
</filelist>
Modified: trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
===================================================================
--- trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-11-13 10:53:18 UTC (rev 3941)
+++ trunk/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-11-13 11:06:27 UTC (rev 3942)
@@ -38,7 +38,7 @@
</h:panelGrid>
<br />
<br />
- <calendar:calendar/>
+ <calendar:calendar datePattern=""/>
<calendar:calendar cellWidth="5" cellHeight="5"/>
<calendar:calendar cellWidth="40" cellHeight="40"/>
<calendar:calendar
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-13 10:53:18 UTC (rev 3941)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-11-13 11:06:27 UTC (rev 3942)
@@ -269,10 +269,11 @@
var counter=1;
var y,m,d;
+ var a,h,min;
var shortLabel=false;
pattern = pattern.replace(/([.*+?^<>=!:${}()|[\]\/\\])/g, '\\$1');
- pattern = pattern.replace(/(y+|M+|d+)/g,
+ pattern = pattern.replace(/(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
function($1) {
switch ($1) {
case 'y' :
@@ -281,6 +282,12 @@
case 'M' : m=counter; counter++; return '(\\d{1,2})';
case 'd' : d=counter; counter++; return '(\\d{1,2})';
case 'MMM': m=counter; counter++; shortLabel=true; return '('+monthNamesShort.join('|')+')';
+ case 'a' : a=counter; counter++; return '(AM|am|PM|pm)?';
+ case 'HH' :
+ case 'hh' : h=counter; counter++; return '(\\d{2})?';
+ case 'H' :
+ case 'h' : h=counter; counter++; return '(\\d{1,2})?';
+ case 'mm' : min=counter; counter++; return '(\\d{2})?';
}
// y+,M+,d+
var ch = $1.charAt(0);
@@ -297,34 +304,72 @@
var yy = parseInt(match[y],10); if (isNaN(yy)) return null; else if (yy<70) yy+=2000; else if (yy<100) yy+=1900;
var mm = parseInt(match[m],10); if (isNaN(mm)) mm = Richfaces.Calendar.getMonthByLabel(match[m], shortLabel ? monthNamesShort : monthNames); else if (--mm<0 || mm>11) return null;
var dd = parseInt(match[d],10); if (isNaN(dd) || dd<1 || dd>daysInMonth(yy, mm)) return null;
+
+ // time parsing
+ if (min!=undefined && h!=undefined)
+ {
+ var hh,mmin,aa;
+ mmin = parseInt(match[min],10); if (isNaN(mmin) || mmin<0 || mmin>59) return null;
+ hh = parseInt(match[h],10); if (isNaN(hh)) return null;
+ if (a!=undefined)
+ {
+ aa = match[a].toLowerCase();
+ if ((aa!='am' && aa!='pm') || hh<1 || hh>12) return null;
+ if (aa=='pm')
+ {
+ if (hh!=12) hh+=11;
+ } else if (hh==12) hh = 0;
+ }
+ else if (hh<0 || hh>23) return null;
+
+ return new Date(yy, mm, dd, hh, mmin, 0);
+ }
+
return new Date(yy, mm, dd);
}
return null;
- }
+ },
+
+ escape : function (str)
+ {
+ return str.replace(/[yMdaHhm]/g,"\\$1");
+ },
+
+ unescape : function (str)
+ {
+ return str.replace(/\\([yMdaHhm])/g,"$1");
+ }
});
Object.extend(Date.prototype, {
format : function(pattern, monthNames, monthNamesShort) {
if (!monthNames) monthNames = Date.getDefaultMonthNames();
if (!monthNamesShort) monthNamesShort = Date.getDefaultMonthNames(true);
- var d = this; var mm; var dd;
- return pattern.replace(/(y+|M+|d+)/g,
- function($1) {
- switch ($1) {
+ var d = this; var mm; var dd; var hh;
+ var result = pattern.replace(/(^|[^\\yMdHhm])(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
+ function($1,$2,$3) {
+ switch ($3) {
case 'y':
- case 'yy': return str = d.getYear().toString().slice(-2);
- case 'M': return d.getMonth()+1;
- case 'MM': return (mm = d.getMonth()+1)<10 ? '0'+mm : mm;
- case 'MMM': return monthNamesShort[d.getMonth()];
- case 'd': return d.getDate();
+ case 'yy': return $2+d.getYear().toString().slice(-2);
+ case 'M': return $2+(d.getMonth()+1);
+ case 'MM': return $2+((mm = d.getMonth()+1)<10 ? '0'+mm : mm);
+ case 'MMM': return $2+monthNamesShort[d.getMonth()];
+ case 'd': return $2+d.getDate();
+ case 'a' : return $2+(d.getHours()<12 ? 'AM' : 'PM');
+ case 'HH' : return $2+((hh = d.getHours())<10 ? '0'+hh : hh);
+ case 'H' : return $2+d.getHours();
+ case 'hh' : return $2+((hh = d.getHours())==0 ? '12' : (hh<10 ? '0'+hh : (hh>12 ? hh-12 : hh)));
+ case 'h' : return $2+((hh = d.getHours())==0 ? '12' : (hh>12 ? hh-12 : hh));
+ case 'mm' : return $2+((min = d.getMinutes())<10 ? '0'+min : min);
}
// y+,M+,d+
- var ch = $1.charAt(0);
- if (ch=='y') return d.getFullYear();
- if (ch=='M') return monthNames[d.getMonth()];
- if (ch=='d') return (dd = d.getDate())<10 ? '0'+dd : dd;
+ var ch = $3.charAt(0);
+ if (ch=='y') return $2+d.getFullYear();
+ if (ch=='M') return $2+monthNames[d.getMonth()];
+ if (ch=='d') return $2+((dd = d.getDate())<10 ? '0'+dd : dd);
}
);
+ return Date.unescape(result);
}
});
@@ -434,8 +479,11 @@
this.params = parameters;
if (!this.params.showWeekDaysBar) this.params.showWeekDaysBar = true;
if (!this.params.showWeeksBar) this.params.showWeeksBar = true;
- if (!this.params.datePattern) thisparams.datePattern = "MMM d, y";
+ if (!this.params.datePattern) this.params.datePattern = "MMM d, y h:mm a";
+ // time
+ this.setTimeProperties();
+
// markups initialization
if (!this.params.dayListMarkup)
{
@@ -591,6 +639,41 @@
},
+ setTimeProperties: function() {
+ this.timeType = 0;
+ this.dateTimePattern = this.params.datePattern;
+ var h,hh,m,a;
+ this.dateTimePattern = this.dateTimePattern.replace(/(^|[^\\Hhm])(H{1,2}|h{1,2}|m{2}|a)/g,
+ function($1,$2,$3) {
+ switch ($3) {
+ case 'a' : a=true; return $2+'<sp\\an st\\yle="b\\ackgroun\\d-color:#BED6F8;" onclick="Ric\\hf\\aces.getCo\\mponent(\'c\\alen\\d\\ar\',t\\his).c\\h\\angeTi\\me(t\\his,\'\\a\'); return true;">'+$3+'</sp\\an>';
+ case 'H' :
+ case 'HH' : h=true; return $2+'<sp\\an st\\yle="b\\ackgroun\\d-color:#BED6F8;" onclick="Ric\\hf\\aces.getCo\\mponent(\'c\\alen\\d\\ar\',t\\his).c\\h\\angeTi\\me(t\\his,\'\\h\'); return true;">'+$3+'</sp\\an>';
+ case 'h' :
+ case 'hh' : hh=true; return $2+'<sp\\an st\\yle="b\\ackgroun\\d-color:#BED6F8;" onclick="Ric\\hf\\aces.getCo\\mponent(\'c\\alen\\d\\ar\',t\\his).c\\h\\angeTi\\me(t\\his,\'\\hh\'); return true;">'+$3+'</sp\\an>';
+ case 'mm' : m=true; return $2+'<sp\\an st\\yle="b\\ackgroun\\d-color:#BED6F8;" onclick="Ric\\hf\\aces.getCo\\mponent(\'c\\alen\\d\\ar\',t\\his).c\\h\\angeTi\\me(t\\his,\'\\m\'); return true;">'+$3+'</sp\\an>';
+ }
+ }
+ );
+ if (m && h) this.timeType = 1;
+ else if (m && hh && a) this.timeType = 2;
+ },
+
+ changeTime: function(element, v) {
+ if (v=='a')
+ {
+ var h = this.selectedDate.getHours();
+ if (h>11) {
+ h -= 12;
+ } else {
+ h +=12;
+ }
+ this.selectedDate.setHours(h);
+ this.renderHeader();
+ this.renderFooter();
+ }
+ },
+
doCollapse: function() {
if (!this.params.popup || !this.isVisible) return;
@@ -1471,13 +1554,17 @@
return new E('div',attr,[new T(text)]);
};
-CalendarView.getSelectedDateControl = function(text, functionName) {
+CalendarView.getSelectedDateControl = function(calendar, functionName) {
var attr = {
onclick: "Richfaces.getComponent('calendar',this).showSelectedDate(); return true;",
className: "rich-calendar-btn"
};
- var a = [new T(text)];
+ var text = "";
+ if (calendar.selectedDate) text = calendar.selectedDate.format( (calendar.timeType ? calendar.dateTimePattern : calendar.params.datePattern), calendar.params.monthLabels, calendar.params.monthLabelsShort);
+
+
+ var a = [new ET(text)];
if (text)
{
a.push(new T(" "));
@@ -1493,8 +1580,7 @@
CalendarView.previousMonthControl = CalendarView.getControl("<", "prevMonth");
CalendarView.currentMonthControl = function (context) { return context.calendar.getCurrentDate().format("MMMM, yyyy", context.monthLabels, context.monthLabelsShort);};
CalendarView.todayControl = CalendarView.getControl("Today", "today");
-CalendarView.selectedDateControl = function (context) { return CalendarView.getSelectedDateControl(context.calendar.getSelectedDateString(context.calendar.params.datePattern));};
-//CalendarView.resetSelectedDateControl = function (context) { return (context.calendar.getSelectedDate() ? CalendarView.getControl("x", "resetSelectedDate") : "");};
+CalendarView.selectedDateControl = function (context) { return CalendarView.getSelectedDateControl(context.calendar);};
CalendarView.header = [
new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
@@ -1572,6 +1658,5 @@
previousMonthControl: CalendarView.previousMonthControl,
currentMonthControl: CalendarView.currentMonthControl,
todayControl: CalendarView.todayControl,
- selectedDateControl: CalendarView.selectedDateControl
- //resetSelectedDateControl: CalendarView.resetSelectedDateControl,
+ selectedDateControl: CalendarView.selectedDateControl,
});
\ No newline at end of file
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-11-13 10:53:18 UTC (rev 3941)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-11-13 11:06:27 UTC (rev 3942)
@@ -9,7 +9,7 @@
baseclass="org.richfaces.renderkit.CalendarRendererBase"
component="org.richfaces.component.UICalendar">
<f:clientid var="clientId" />
- <h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),new org.ajax4jsf.javascript.AjaxScript(),/org/richfaces/renderkit/html/scripts/events.js,/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js,/org/richfaces/renderkit/html/scripts/scriptaculous/effects.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
+ <h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),new org.ajax4jsf.javascript.AjaxScript(),/org/richfaces/renderkit/html/scripts/events.js,/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js,/org/richfaces/renderkit/html/scripts/scriptaculous/effects.js,/org/richfaces/renderkit/html/scripts/jquery/jquery.js,/org/richfaces/renderkit/html/scripts/jquery.jcarousel.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
<h:styles>/org/richfaces/renderkit/html/css/calendar.xcss</h:styles>
18 years, 5 months
JBoss Rich Faces SVN: r3941 - trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2007-11-13 05:53:18 -0500 (Tue, 13 Nov 2007)
New Revision: 3941
Modified:
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
Log:
scroll handler was corrected
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-12 23:07:54 UTC (rev 3940)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/Control.js 2007-11-13 10:53:18 UTC (rev 3941)
@@ -9,10 +9,10 @@
}
Control.CLASSES = {
- first : {hidden : "ol_control_hidden", shown : "ol_control_shown", disabled : "", enabled : ""},
- down : {hidden : "ol_control_hidden", shown : "ol_control_shown", disabled : "", enabled : ""},
- up : {hidden : "ol_control_hidden", shown : "ol_control_shown", disabled : "", enabled : ""},
- last : {hidden : "ol_control_hidden", shown : "ol_control_shown", disabled : "", enabled : ""}
+ first : {hidden : "ol_button ol_control_hidden", shown : "ol_button ol_control_shown"},
+ down : {hidden : "ol_button ol_control_hidden", shown : "ol_button ol_control_shown"},
+ up : {hidden : "ol_button ol_control_hidden", shown : "ol_button ol_control_shown"},
+ last : {hidden : "ol_button ol_control_hidden", shown : "ol_button ol_control_shown"}
};
Control.prototype.doShow = function() {
Modified: trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js
===================================================================
--- trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-12 23:07:54 UTC (rev 3940)
+++ trunk/sandbox/ui/orderingList/src/main/resources/org/richfaces/renderkit/html/scripts/OrderingList.js 2007-11-13 10:53:18 UTC (rev 3941)
@@ -476,16 +476,21 @@
Shuttle.prototype.autoScrolling = function(action, event) {
this.selectedItems.sort(this.compareByRowIndex);
- var targetItemTop;
+ var increment;
+ var scrollTop = this.shuttleTable.parentNode.scrollTop;
if (action == 'up' || action == 'first') {
- targetItemTop = LayoutManager.getElemXY(this.selectedItems[0]).top;
- var increment = targetItemTop - this.shuttleTop;
- this.shuttleTable.parentNode.scrollTop = increment;
+ var targetItemTop = LayoutManager.getElemXY(this.selectedItems[0]).top;
+ increment = (targetItemTop - scrollTop) - this.shuttleTop;
+ if (increment < 0) {
+ this.shuttleTable.parentNode.scrollTop += increment;
+ }
} else if (action == 'down' || action == 'last') {
var item = this.selectedItems[this.selectedItems.length - 1];
- targetItemTop = LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length - 1]).top + item.offsetHeight;
- var increment = targetItemTop - (this.shuttleTop + this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
- this.shuttleTable.parentNode.scrollTop = increment;
+ targetItemBottom = LayoutManager.getElemXY(this.selectedItems[this.selectedItems.length - 1]).top + item.offsetHeight;
+ var increment = (targetItemBottom - scrollTop) - (this.shuttleTop + this.shuttleTable.parentNode.offsetHeight - LayoutManager.SCROLL_WIDTH);
+ if (increment > 0) {
+ this.shuttleTable.parentNode.scrollTop += increment;
+ }
}
Shuttle.stopPropogation(event);
}
18 years, 5 months
JBoss Rich Faces SVN: r3940 - branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 18:07:54 -0500 (Mon, 12 Nov 2007)
New Revision: 3940
Modified:
branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
http://jira.jboss.com/jira/browse/RF-1335
Modified: branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-11-12 22:55:26 UTC (rev 3939)
+++ branches/3.1.x/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-11-12 23:07:54 UTC (rev 3940)
@@ -145,7 +145,7 @@
this.header = new ModalPanel.Border(id + "Header", this, "move", ModalPanel.Header);
}
- this.markerId.modalPanel = this;
+ this.markerId.component = this;
var eDiv = $(this.div);
if (eDiv.style.setExpression)
@@ -213,7 +213,7 @@
discardElement(element);
}
}
- this.markerId.modalPanel = null;
+ this.markerId.component = null;
this.markerId = null;
},
@@ -925,7 +925,7 @@
panel = Richfaces.findModalPanel(id);
}
invoke(function() {
- panel.modalPanel.show(opts);
+ panel.component.show(opts);
});
@@ -936,5 +936,5 @@
if (!panel) {
panel = Richfaces.findModalPanel(id);
}
- panel.modalPanel.hide(opts);
+ panel.component.hide(opts);
};
18 years, 5 months
JBoss Rich Faces SVN: r3939 - trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 17:55:26 -0500 (Mon, 12 Nov 2007)
New Revision: 3939
Modified:
trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
Log:
http://jira.jboss.com/jira/browse/RF-1335
Modified: trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js
===================================================================
--- trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-11-12 22:10:32 UTC (rev 3938)
+++ trunk/ui/modal-panel/src/main/resources/org/richfaces/renderkit/html/scripts/modalPanel.js 2007-11-12 22:55:26 UTC (rev 3939)
@@ -181,7 +181,7 @@
this.header = new ModalPanel.Border(id + "Header", this, "move", ModalPanel.Header);
}
- this.markerId.modalPanel = this;
+ this.markerId.component = this;
var eDiv = $(this.div);
if (eDiv.style.setExpression)
@@ -249,7 +249,7 @@
discardElement(element);
}
}
- this.markerId.modalPanel = null;
+ this.markerId.component = null;
this.markerId = null;
},
@@ -972,7 +972,7 @@
panel = Richfaces.findModalPanel(id);
}
invoke(function() {
- panel.modalPanel.show(opts);
+ panel.component.show(opts);
});
@@ -983,5 +983,5 @@
if (!panel) {
panel = Richfaces.findModalPanel(id);
}
- panel.modalPanel.hide(opts);
+ panel.component.hide(opts);
};
18 years, 5 months
JBoss Rich Faces SVN: r3938 - in trunk/sandbox: samples/rex-demo/src/main/webapp/richfaces/resizable and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: SergeySmirnov
Date: 2007-11-12 17:10:32 -0500 (Mon, 12 Nov 2007)
New Revision: 3938
Modified:
trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/button/examples/simple.xhtml
trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/usage.xhtml
trunk/sandbox/ui/componentControl/src/main/java/org/richfaces/sandbox/component/UIComponentControl.java
trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx
Log:
server side attachment for componentControl has been added added
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/button/examples/simple.xhtml
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/button/examples/simple.xhtml 2007-11-12 20:20:31 UTC (rev 3937)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/button/examples/simple.xhtml 2007-11-12 22:10:32 UTC (rev 3938)
@@ -10,7 +10,12 @@
<f:view contentType="text/html">
+ <h:inputText >
+ <cc:componentControl name="controlMe" event="onclick" attachTiming="onload" for="mb4" params="animEl:'d:mb4'" operation="show"/>
+ </h:inputText>
+
+
<h:form id="f">
<rex:button id="a" style="color:red" value="The real button Name">
@@ -19,29 +24,26 @@
<rich:panel id="mb3" style="width:100px;border:1px solid red">Start</rich:panel>
- <cc:componentControl event="onclick" attachTo="mb3" for="mb4" operation="show"/>
-
- <rex:button id="mb4" onclick="aaa()" value="Show Box" />
-
-
</h:form>
+ <f:subview id="d">
+ <rex:button id="mb4" onclick="aaa()" value="Show Box" />
+ </f:subview>
-
<rich:modalPanel id="dd">
<h:outputText value="hello" />
</rich:modalPanel>
<script>
- jQuery('#f\\:mb4')[0].component = {};
- jQuery('#f\\:mb4')[0].component.show = function(event, params) {
- jQuery('#f\\:mb4').click();
+ jQuery('#d\\:mb4')[0].component = {};
+ jQuery('#d\\:mb4')[0].component.show = function(event, params) {
+ jQuery('#d\\:mb4').click();
}
</script>
- <button onclick="upup()">UpUp</button>
+ <button onclick="controlMe()">UpUp</button>
Modified: trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/usage.xhtml
===================================================================
--- trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/usage.xhtml 2007-11-12 20:20:31 UTC (rev 3937)
+++ trunk/sandbox/samples/rex-demo/src/main/webapp/richfaces/resizable/usage.xhtml 2007-11-12 22:10:32 UTC (rev 3938)
@@ -14,9 +14,9 @@
<div class="sample-container" >
- <ui:include src="/richfaces/button/examples/simple.xhtml"/>
+ <ui:include src="/richfaces/resizable/examples/simple.xhtml"/>
<ui:include src="/templates/include/sourceview.xhtml">
- <ui:param name="sourcepath" value="/richfaces/button/examples/simple.xhtml"/>
+ <ui:param name="sourcepath" value="/richfaces/resizable/examples/simple.xhtml"/>
</ui:include>
</div>
Modified: trunk/sandbox/ui/componentControl/src/main/java/org/richfaces/sandbox/component/UIComponentControl.java
===================================================================
--- trunk/sandbox/ui/componentControl/src/main/java/org/richfaces/sandbox/component/UIComponentControl.java 2007-11-12 20:20:31 UTC (rev 3937)
+++ trunk/sandbox/ui/componentControl/src/main/java/org/richfaces/sandbox/component/UIComponentControl.java 2007-11-12 22:10:32 UTC (rev 3938)
@@ -4,16 +4,106 @@
package org.richfaces.sandbox.component;
+import org.ajax4jsf.Messages;
+import org.ajax4jsf.component.EventValueBinding;
import javax.faces.component.UIComponentBase;
+import javax.faces.context.FacesContext;
+import javax.faces.component.UIComponent;
+import org.ajax4jsf.component.AjaxSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.ajax4jsf.renderkit.RendererUtils;
+import org.richfaces.component.util.HtmlUtil;
/**
* JSF component class
*
*/
-public abstract class UIComponentControl extends UIComponentBase {
+public abstract class UIComponentControl extends UIComponentBase implements AjaxSupport {
public static final String COMPONENT_TYPE = "org.richfaces.sandbox.ComponentControl";
public static final String COMPONENT_FAMILY = "org.richfaces.sandbox.ComponentControl";
+
+ private static final Log log = LogFactory.getLog(UIComponentControl.class);
+
+ /**
+ * @return JavaScript eventString. Rebuild on every call, since
+ * can be in loop ( as in dataTable ) with different parameters.
+ */
+ public String getEventString()
+ {
+ StringBuffer buildOnEvent = new StringBuffer();
+
+ String targetId="#" + getFor();
+
+ targetId=HtmlUtil.expandIdSelector(targetId, this, FacesContext.getCurrentInstance());
+
+ buildOnEvent.append("Richfaces.componentControl.performOperation( null,");
+ buildOnEvent.append("'" + targetId + "',");
+ buildOnEvent.append("'" + getOperation() + "',");
+ buildOnEvent.append("{" + getParams() + "});");
+
+ return buildOnEvent.toString();
+
+
+ }
+
+
+ public abstract String getEvent();
+ public abstract void setEvent(String event);
+
+ public abstract String getFor();
+ public abstract void setFor(String value);
+
+ public abstract String getParams();
+ public abstract void setParams(String value);
+
+ public abstract String getOperation();
+ public abstract void setOperation(String value);
+
+ public abstract String getAttachTo();
+ public abstract void setAttachTo(String value);
+
+ protected String replaceClientIds(FacesContext context, UIComponent component, String selector) {
+ return HtmlUtil.expandIdSelector(selector, component, context);
+ }
+
+
+ /**
+ * After nornal setting <code>parent</code> property in case of
+ * created component set Ajax properties for parent.
+ * @see javax.faces.component.UIComponentBase#setParent(javax.faces.component.UIComponent)
+ */
+ public void setParent(UIComponent parent)
+ {
+ super.setParent(parent);
+ if (null != parent && parent.getFamily() != null ) {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.CALLED_SET_PARENT, parent.getClass().getName()));
+ }
+ // TODO If this comopnent configured, set properties for parent component.
+ // NEW created component have parent, restored view - null in My faces.
+ // and SUN RI not call at restore saved view.
+ // In other case - set in restoreState method.
+ // if (parent.getParent() != null)
+ {
+ if (log.isDebugEnabled()) {
+ log.debug(Messages.getMessage(Messages.DETECT_NEW_COMPONENT));
+ }
+ setParentProperties(parent);
+
+ }
+ }
+ }
+
+
+ public void setParentProperties(UIComponent parent){
+ if (getAttachTo() == "" && getEvent() !="" ) {
+ parent.setValueBinding(getEvent(), new EventValueBinding(this));
+ }
+ }
+
+
}
Modified: trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx
===================================================================
--- trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2007-11-12 20:20:31 UTC (rev 3937)
+++ trunk/sandbox/ui/componentControl/src/main/templates/htmlComponentControl.jspx 2007-11-12 22:10:32 UTC (rev 3938)
@@ -24,19 +24,15 @@
<jsp:scriptlet>
<![CDATA[
String event = (String) variables.getVariable("event");
- String forAttr = (String) variables.getVariable("forAttr");
+ String forAttr = "#"+(String) variables.getVariable("forAttr");
String attachTiming = (String) variables.getVariable("attachTiming");
- String attachTo = (String) variables.getVariable("attachTo");
+ String attachTo = "#"+(String) variables.getVariable("attachTo");
String name = (String) variables.getVariable("name");
String operation = (String) variables.getVariable("operation");
checkValidity(clientId, name, attachTiming, forAttr, operation);
- System.out.println("Before search for client id:" + forAttr);
- variables.setVariable("forAttr", replaceClientIds(context, component, "#" + forAttr));
- System.out.println("After search for client id:" + (String) variables.getVariable("forAttr"));
- System.out.println("Before search for client id:" + attachTo);
- variables.setVariable("attachTo", replaceClientIds(context, component, "#" + attachTo));
- System.out.println("After search for client id:" + (String) variables.getVariable("attachTo"));
+ variables.setVariable("forAttr", replaceClientIds(context, component, forAttr));
+ variables.setVariable("attachTo", replaceClientIds(context, component, attachTo));
]]>
</jsp:scriptlet>
@@ -52,7 +48,7 @@
<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
-<jsp:scriptlet><![CDATA[ if ( "immediate".equals(attachTiming) ) { ]]></jsp:scriptlet>
+<jsp:scriptlet><![CDATA[ if ( "immediate".equals(attachTiming) && ! "#".equals(attachTo) ) { ]]></jsp:scriptlet>
<script type="text/javascript">
//<![CDATA[
{
@@ -67,7 +63,7 @@
-<jsp:scriptlet><![CDATA[ if ( "onload".equals(attachTiming) ) { ]]></jsp:scriptlet>
+<jsp:scriptlet><![CDATA[ if ( "onload".equals(attachTiming) && ! "#".equals(attachTo) ) {]]></jsp:scriptlet>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function() {
@@ -78,11 +74,5 @@
//]]>
</script>
<jsp:scriptlet><![CDATA[ } ]]></jsp:scriptlet>
-
-
- <div id="#{clientId}"
- x:passThruWithExclusions="value,name,type,id"
- >Here we start
- </div>
</f:root>
\ No newline at end of file
18 years, 5 months
JBoss Rich Faces SVN: r3937 - in trunk/sandbox/samples/orderingListDemo/src/main: webapp/pages and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-11-12 15:20:31 -0500 (Mon, 12 Nov 2007)
New Revision: 3937
Modified:
trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
Log:
VB handling for activeItem/selection added
Modified: trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-12 20:18:12 UTC (rev 3936)
+++ trunk/sandbox/samples/orderingListDemo/src/main/java/org/richfaces/Bean.java 2007-11-12 20:20:31 UTC (rev 3937)
@@ -22,6 +22,7 @@
package org.richfaces;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import javax.faces.component.UIComponent;
@@ -177,5 +178,26 @@
public void setEventsBouncer(UIComponent component) {
this.eventsBouncer = component;
}
+
+ private Collection selection;
+
+ private Object activeItem;
+
+ public Collection getSelection() {
+ return selection;
+ }
+
+ public void setSelection(Collection selection) {
+ System.out.println("Bean.setSelection() " + selection);
+ this.selection = selection;
+ }
+ public Object getActiveItem() {
+ return activeItem;
+ }
+
+ public void setActiveItem(Object activeItem) {
+ System.out.println("Bean.setActiveItem() " + activeItem);
+ this.activeItem = activeItem;
+ }
}
\ No newline at end of file
Modified: trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-12 20:18:12 UTC (rev 3936)
+++ trunk/sandbox/samples/orderingListDemo/src/main/webapp/pages/index.jsp 2007-11-12 20:20:31 UTC (rev 3937)
@@ -43,6 +43,9 @@
orderControlsVisible="#{demoBean.orderControlsVisible}"
fastOrderControlsVisible="#{demoBean.fastOrderControlsVisible}"
+ selection="#{bean.selection}"
+ activeItem="#{bean.activeItem}"
+
ontopclick="#{demoBean.ontopclick}"
onbottomclick="#{demoBean.onbottomclick}"
onorderchanged="new Effect.Highlight('form:onorderchangedDiv', {startcolor:'#FF0000', endcolor:'#FF0000'});"
18 years, 5 months