JBoss Rich Faces SVN: r17744 - in root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources: org.richfaces and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 12:55:26 -0400 (Tue, 06 Jul 2010)
New Revision: 17744
Added:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_down_button.gif
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_button.png
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_field.png
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_shadow.png
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/richfaces-selection.js
Log:
Latest comboBox changes check-in
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.ecss 2010-07-06 16:55:26 UTC (rev 17744)
@@ -0,0 +1,147 @@
+* {
+ font-size: 11px;
+ font-family: verdana;
+ color: #000000
+}
+
+.cb_field_width {
+ width: 100px;
+}
+
+.cb_list_width {
+ width: 200px;
+}
+
+.cb_list_height {
+ height: 100px;
+}
+
+input.cb_font {
+ color: #000000 /*generalTextColor*/
+}
+
+input.cb_input {
+ border: 0px;
+ background: none;
+ width: 100%;
+}
+
+.cb_field {
+ position: inline-block;
+ border: 1px solid #A6A6A6 /*panelBorderColor*/;
+ display: inline-block;
+ background-image: "url(#{resource['org.richfaces:combo_list_field.png']})";
+ background-repeat: repeat-x;
+ background-position: top left;
+ /*gradient - from additionalBackgroundColor to controlBackgroundColor, background-color - controlBackgroundColor*/;
+}
+
+.cb_button {
+ background-image: "url(#{resource['org.richfaces:combo_list_button.png']})";
+ background-repeat: repeat-x;
+ background-position: top left;
+ background-color: #C0D1E7;
+ /*gradient - from headerGradientColor to headerBackgroundColor, background-color - headerBackgroundColor*/;
+ text-align: center;
+ border-left: 1px solid #A6A6A6 /*panelBorderColor*/;
+ width: 15px;
+ position: absolute;
+ top: 0px;
+ right: 0px;
+ height: 200px;
+ padding-top: 1px
+}
+
+.cb_button_arrow {
+ background-position: center;
+ background-repeat: no-repeat;
+ background-image: "url(#{resource['org.richfaces:combo_down_button.gif']})";
+ cursor: pointer;
+ width: 15px;
+ height: 15px;
+}
+
+.cb_list_cord {
+ position: absolute;
+ font-size: 0px;
+} /*DDL is hidden!!!!!*/
+
+.cb_list_decoration {
+ border: 1px solid #A6A6A6 /*panelBorderColor*/;
+ padding: 0px;
+ background: #FFFFFF; /*tableBackgroundColor*/
+}
+
+.cb_list_scroll {
+ overflow: auto;
+ overflow-x: hidden;
+}
+
+.cb_option {
+ padding: 2px;
+ white-space: nowrap;
+ cursor: default;
+ list-style-type: none;
+}
+
+.cb_select {
+ padding: 1px;
+ width: 100%;
+ background-color: #DFE8F6;
+ border: 1px dotted #a3bae9; /*generalTextColor*/
+}
+
+.cb_shadow {
+ border: 0px solid red;
+ display: inline-block;
+ position: absolute;
+ float: left;
+ padding: 6px 6px 6px 6px;
+ top: -6px;
+ left: -7px;
+}
+
+.cb_shadow_t {
+ background-image: "url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: top left;
+ position: absolute;
+ width: 6px;
+ top: 0px;
+ bottom: 6px;
+ left: 0px
+}
+
+.cb_shadow_l {
+ background-image: "url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: bottom left;
+ position: absolute;
+ height: 6px;
+ bottom: 0px;
+ left: 0px;
+ right: 6px;
+}
+
+.cb_shadow_r {
+ background-image: "url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: bottom right;
+ position: absolute;
+ width: 6px;
+ top: 6px;
+ bottom: 0px;
+ right: 0px;
+}
+
+.cb_shadow_b {
+ background-image: "url(#{resource['org.richfaces:combo_list_shadow.png']})";
+ background-position: right top;
+ position: absolute;
+ height: 6px;
+ top: 0px;
+ left: 6px;
+ right: 0px;
+}
+
+.cb_list_ul {
+ margin: 0px;
+ padding: 0px;
+}
\ No newline at end of file
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/ComboBox.js 2010-07-06 16:55:26 UTC (rev 17744)
@@ -0,0 +1,225 @@
+(function ($, rf) {
+ rf.utils = rf.utils || {};
+
+ rf.utils.Cache = function (data, options) {
+ this.key = options.key;
+ this.cache = {}
+ this.cache[this.key] = data || [];
+ this.values = options.parse && options.parse(data) || this.cache[this.key];
+ };
+
+ var getItems = function (key) {
+ var newCache = [];
+
+ if (this.cache[key]) {
+ newCache = this.cache[key];
+ } else {
+ var itemsCache = this.cache[this.key];
+ for (var i = 0; i<this.values.length; i++) {
+ var value = this.values[i].toLowerCase();
+ var p = value.indexOf(key.toLowerCase());
+ if (p == 0) {
+ newCache.push(itemsCache[i]);
+ }
+ }
+
+ if ((!this.lastKey || key.indexOf(this.lastKey)!=0) && newCache.length > 0) {
+ //console && console.log && console.log("added key:"+key+" length:" + newCache.length)
+ this.cache[key] = newCache;
+ if (newCache.length==1) {
+ this.lastKey = key;
+ }
+ }
+ }
+
+ return newCache;
+ };
+
+ $.extend(rf.utils.Cache.prototype, (function () {
+ return {
+ getItems: getItems
+ };
+ })());
+
+})(jQuery, RichFaces);
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+ // Constructor definition
+ rf.ui.ComboBox = function(componentId, fieldId, options) {
+ this.namespace = "."+rf.Event.createNamespace(this.name, this.componentId);
+ this.options = {};
+ // call constructor of parent class
+ $super.constructor.call(this, componentId+ID.SELECT, fieldId, options);
+ $p.attachToDom(componentId);
+ this.componentId = componentId;
+ this.options = $.extend(this.options, defaultOptions, options);
+ //this.currentValue = rf.getDomElement(this.fieldId).value;
+ this.index = -1;
+ bindEventHandlers.call(this);
+ updateItemsList.call(this, "");
+ };
+
+ var $p ={};
+
+ // Extend component class and add protected methods from parent class to our container
+ $p = rf.ui.SelectBase.extend(rf.ui.SelectBase, rf.ui.ComboBox, $p);
+
+ // define super class link
+ var $super = rf.ui.ComboBox.$super;
+
+ var defaultOptions = {
+ selectedItemClass:'cb_select',
+ autoFill:true
+ };
+
+ var ID = {
+ SELECT:'List',
+ ITEMS:'Items'
+ };
+
+ var bindEventHandlers = function () {
+ rf.Event.bindById(this.componentId+ID.ITEMS, "mouseover"+this.namespace, onMouseOver, this);
+ };
+
+ var onMouseOver = function(event) {
+ console && console.log && console.log("mouseOver");
+ var element = event.target;
+ while (element.parentNode && element.parentNode!=event.currentTarget) {
+ element = element.parentNode;
+ };
+ if (element.parentNode) {
+ var index = this.items.index(element);
+ if (index!=this.index) {
+ this.selectItem(index);
+ }
+ }
+ };
+
+ var updateItemsList = function (value) {
+ this.items = $(rf.getDomElement(this.componentId+ID.ITEMS)).children();
+ this.cache = new rf.utils.Cache(this.items, {
+ parse: getData,
+ key: value
+ });
+ };
+
+ var getData = function (nodeList) {
+ var data = [];
+ nodeList.each(function () {
+ data.push($(this).text());
+ });
+ return data;
+ };
+
+ var scrollToSelectedItem = function() {
+ var offset = 0;
+ this.items.slice(0, this.index).each(function() {
+ offset += this.offsetHeight;
+ });
+ var itemsContainer = this.items.first().parent();
+ if(offset < itemsContainer.scrollTop()) {
+ itemsContainer.scrollTop(offset);
+ } else {
+ offset+=this.items.get(this.index).offsetHeight;
+ if(offset - itemsContainer.scrollTop() > itemsContainer.get(0).clientHeight) {
+ itemsContainer.scrollTop(offset - itemsContainer.innerHeight());
+ }
+ }
+ };
+
+ var autoFill = function (inputValue, value) {
+ if( this.options.autoFill) {
+ var field = rf.getDomElement(this.fieldId);
+ field.value = inputValue + value.substring(inputValue.length);
+ rf.Selection.set(field, inputValue.length, field.value.length);
+ }
+ };
+
+ // Add new properties and methods
+ $.extend(rf.ui.SelectBase.prototype, (function () {
+ return {
+ name:"CompoBox",
+ destroy: function () {
+ //TODO: add all unbind
+ $super.destroy.call(this);
+ },
+ getNamespace: function () {
+ return this.namespace;
+ },
+
+ selectItem: function(index, isOffset, noAutoFill) {
+ if (this.items.length==0) return;
+
+ if (this.index!=-1) {
+ this.items.eq(this.index).removeClass(this.options.selectedItemClass);
+ }
+
+ if (index==undefined) {
+ this.index = -1;
+ return;
+ }
+
+ if (isOffset) {
+ this.index += index;
+ if ( this.index<0 ) {
+ this.index = this.items.length - 1;
+ } else if (this.index >= this.items.length) {
+ this.index = 0;
+ }
+ } else {
+ if (index<0) {
+ index = 0;
+ } else if (index>=this.items.length) {
+ index = this.items.length - 1;
+ }
+ this.index = index;
+ }
+ var item = this.items.eq(this.index);
+ item.addClass(this.options.selectedItemClass);
+
+ scrollToSelectedItem.call(this);
+ !noAutoFill && autoFill.call(this, this.newValue, item.text());
+ },
+
+ selectPrevItem: function () {
+ this.selectItem(-1, true);
+ },
+ selectNextItem: function () {
+ this.selectItem(1, true);
+ },
+ selectPageUp: function () {
+
+ },
+ selectPageDown: function () {
+
+ },
+ onBeforeShow: function (event) {
+ },
+
+ changeValue: function (event, value) {
+ // TODO: ajax call here if needed
+
+ this.selectItem();
+ var newItems = this.cache.getItems(value);
+ this.items = $(newItems);
+ $(rf.getDomElement(this.componentId+ID.ITEMS)).empty().append(newItems);
+ this.index = -1;
+ this.newValue = value;
+ this.selectItem(0, false, event.which == rf.KEYS.BACKSPACE);
+ },
+
+ onShow: function (event) {
+ if (this.items && this.items.length>0) {
+ //??TODO it's nessesary only if not changed value
+ this.selectItem(0);
+ }
+ },
+
+ onHide: function () {
+ this.selectItem();
+ }
+ };
+ })());
+})(jQuery, RichFaces);
\ No newline at end of file
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/SelectBase.js 2010-07-06 16:55:26 UTC (rev 17744)
@@ -0,0 +1,256 @@
+// TODO: move this extend to RichFaces.Event for exapmle
+$.extend(RichFaces.Event, {
+ bindScrollEventHandlers: function(element, handler, component) {
+ var elements = [];
+ element = RichFaces.getDomElement(element).parentNode;
+ while (element && element!=window.document.body)
+ {
+ if (element.offsetWidth!=element.scrollWidth || element.offsetHeight!=element.scrollHeight)
+ {
+ elements.push(element);
+ RichFaces.Event.bind(element, "scroll"+component.getNamespace(), handler, component);
+ }
+ element = element.parentNode;
+ }
+ return elements;
+ },
+ unbindScrollEventHandlers: function(elements, component) {
+ RichFaces.Event.unbind(elements, component.getNamespace());
+ elements = null;
+ }
+});
+
+(function (rf) {
+ rf.KEYS = {
+ BACKSPACE: 8,
+ TAB: 9,
+ RETURN: 13,
+ ESC: 27,
+ PAGEUP: 33,
+ PAGEDOWN: 34,
+ LEFT: 37,
+ UP: 38,
+ RIGHT: 39,
+ DOWN: 40,
+ DEL: 46,
+ }
+})(RichFaces);
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ // Constructor definition
+ rf.ui.SelectBase = function(selectId, fieldId, options) {
+ // call constructor of parent class
+ $super.constructor.call(this, selectId);
+ this.selectId = selectId;
+ this.fieldId = fieldId;
+ this.options = $.extend({}, defaultOptions, options);
+ this.namespace = this.namespace || "."+rf.Event.createNamespace(this.name, this.selectId);
+ this.currentValue = this.getInputValue();
+ bindEventHandlers.call(this);
+ };
+
+ var $p ={};
+
+ // Extend component class and add protected methods from parent class to our container
+ $p = rf.BaseComponent.extend(rf.BaseComponent, rf.ui.SelectBase, $p);
+
+ // define super class link
+ var $super = rf.ui.SelectBase.$super;
+
+ var defaultOptions = {
+ changeDelay:8
+ };
+
+ var bindEventHandlers = function() {
+ if (this.options.buttonId) {
+ rf.Event.bindById(this.options.buttonId, "mousedown"+this.namespace, onButtonShow, this);
+ rf.Event.bindById(this.options.buttonId, "mouseup"+this.namespace, onSelectMouseUp, this);
+ }
+
+ var inputEventHandlers = {};
+ inputEventHandlers["focus"+this.namespace] = onFocus;
+ inputEventHandlers["blur"+this.namespace] = onBlur;
+ inputEventHandlers["click"+this.namespace] = onClick;
+ inputEventHandlers[($.browser.opera ? "keypress" : "keydown")+this.namespace] = onKeyDown;
+ rf.Event.bindById(this.fieldId, inputEventHandlers, this);
+
+ inputEventHandlers = {};
+ inputEventHandlers["click"+this.namespace] = onSelectClick;
+ inputEventHandlers["mousedown"+this.namespace] = onSelectMouseDown;
+ inputEventHandlers["mouseup"+this.namespace] = onSelectMouseUp;
+ rf.Event.bindById(this.selectId, inputEventHandlers, this);
+ }
+
+ var onSelectClick = function () {
+ };
+ var onSelectMouseDown = function () {
+ this.isMouseDown = true;
+ console && console.log && console.log("onMouseDown");
+ };
+ var onSelectMouseUp = function () {
+ //this.isMouseDown = false;
+ rf.getDomElement(this.fieldId).focus();
+ console && console.log && console.log("onMouseUp");
+ };
+
+ var onButtonShow = function (event) {
+ this.isMouseDown = true;
+ console && console.log && console.log("onButtonShow - "+this.timeoutId);
+ if (this.timeoutId) {
+ window.clearTimeout(this.timeoutId);
+ this.timeoutId = null;
+ rf.getDomElement(this.fieldId).focus();
+ }
+
+ if (this.isVisible) {
+ this.hide(event);
+ } else {
+ this.show(event);
+ //rf.getDomElement(this.fieldId).focus();
+ }
+ };
+
+ var onFocus = function (event) {
+ console && console.log && console.log("onFocus");
+ };
+
+ var onBlur = function (event) {
+ console && console.log && console.log("onBlur");
+ if (this.isMouseDown) {
+ rf.getDomElement(this.fieldId).focus();
+ this.isMouseDown = false;
+ console && console.log && console.log("---------> and focus");
+ } else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
+ var _this = this;
+ this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
+ }
+ };
+
+ var onClick = function (event) {
+ };
+
+ var onChange = function (event) {
+ var value = this.getInputValue();
+ var flag = value != this.currentValue;
+ if (event.which == rf.KEYS.LEFT || event.which == rf.KEYS.RIGHT || flag) {
+ if (flag) {
+ this.changeValue(event, value);
+ this.currentValue = value;
+ if (!this.isVisible) {
+ this.show();
+ }
+ }
+ }
+ }
+
+
+ /*var checkOnBlur = function (event) {
+ var e = $(rf.getDomElement(this.options.buttonId));
+ return (e == event.target) || $(event.target).closest(e);
+ };*/
+
+ var onKeyDown = function (event) {
+ switch(event.which) {
+ case rf.KEYS.UP:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPrevItem();
+ }
+ break;
+ case rf.KEYS.DOWN:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectNextItem();
+ } else {
+ this.show();
+ }
+ break;
+ case rf.KEYS.PAGEUP:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPageUp();
+ }
+ break;
+ case rf.KEYS.PAGEDOWN:
+ event.preventDefault();
+ if (this.isVisible) {
+ this.selectPageDown();
+ }
+ break;
+ case rf.KEYS.TAB:
+ case rf.KEYS.RETURN:
+ event.preventDefault();
+ /*if( selectCurrentItem() ) {
+ event.preventDefault();
+ //TODO: bind form submit event handler to cancel form submit under the opera
+ //cancelSubmit = true;
+ return false;
+ }*/
+ this.hide();
+ break;
+ case rf.KEYS.ESC:
+ this.hide();
+ break;
+ default:
+ if (!this.options.selectOnly) {
+ var _this = this;
+ window.clearTimeout(this.changeTimerId);
+ this.changeTimerId = window.setTimeout(function(){onChange.call(_this, event);}, this.options.changeDelay)
+ }
+ break;
+ }
+ }
+
+ // Add new properties and methods
+ $.extend(rf.ui.SelectBase.prototype, (function () {
+ return {
+ name:"SelectBase",
+ show: function (event) {
+ if (this.onBeforeShow(event)!=false) {
+ $(rf.getDomElement(this.selectId)).show();
+ this.isVisible = true;
+ this.scrollElements = rf.Event.bindScrollEventHandlers(this.selectId, this.hide, this, this.namespace);
+ if (this.onShow) {
+ this.onShow(event);
+ }
+ }
+ },
+ hide: function (event) {
+ rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
+ $(rf.getDomElement(this.selectId)).hide();
+ this.isVisible = false;
+ if (this.onHide) {
+ this.onHide(event);
+ }
+ },
+ destroy: function () {
+ //TODO: add all unbind
+ rf.Event.unbindById(this.options.buttonId, this.namespace);
+ rf.Event.unbindById(this.fieldId, this.namespace);
+ $super.destroy.call(this);
+ },
+ getNamespace: function () {
+ return this.namespace;
+ },
+
+ selectPrevItem: function () {
+ },
+ selectNextItem: function () {
+ },
+ selectPageUp: function () {
+ },
+ selectPageDown: function () {
+ },
+ onBeforeShow: function () {
+ },
+ getInputValue: function () {
+ var value = this.fieldId ? rf.getDomElement(this.fieldId).value : undefined;
+ return value;
+ }
+
+ };
+ })());
+})(jQuery, RichFaces);
\ No newline at end of file
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_down_button.gif
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_down_button.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_button.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_button.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_field.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_field.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_shadow.png
===================================================================
(Binary files differ)
Property changes on: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/combo_list_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/richfaces-selection.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/richfaces-selection.js (rev 0)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/org.richfaces/richfaces-selection.js 2010-07-06 16:55:26 UTC (rev 17744)
@@ -0,0 +1,45 @@
+(function (richfaces) {
+
+ richfaces.Selection = richfaces.Selection || {};
+
+ richfaces.Selection.set = function (field, start, end) {
+ if(field.setSelectionRange) {
+ field.focus();
+ field.setSelectionRange(start, end);
+ } else if (field.createTextRange){
+ var range = field.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', end);
+ range.moveStart('character', start);
+ range.select();
+ }
+ }
+
+ richfaces.Selection.getStart = function(field)
+ {
+ if (field.setSelectionRange) {
+ return field.selectionStart;
+ } else if (document.selection && document.selection.createRange) {
+ var r = document.selection.createRange().duplicate();
+ r.moveEnd('character', field.value.length);
+ if (r.text == '') return field.value.length;
+ return field.value.lastIndexOf(r.text);
+ }
+ }
+
+ richfaces.Selection.getEnd = function(field)
+ {
+ if (field.setSelectionRange) {
+ return field.selectionEnd;
+ } else if (document.selection && document.selection.createRange) {
+ var r = document.selection.createRange().duplicate();
+ r.moveStart('character', -field.value.length);
+ return r.text.length;
+ }
+ }
+
+ richfaces.Selection.setCaretTo = function (field, pos)
+ {
+ richfaces.Selection.set(field, pos, pos);
+ }
+})(window.RichFaces || (window.RichFaces={}));
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17743 - in root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces: renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-07-06 12:45:59 -0400 (Tue, 06 Jul 2010)
New Revision: 17743
Modified:
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java
Log:
RF-8101
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-07-06 15:49:47 UTC (rev 17742)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-07-06 16:45:59 UTC (rev 17743)
@@ -78,7 +78,7 @@
}
protected enum PropertyKeys {
- filterVar, sortPriority, sortMode, first, rows, noDataLabel, selectedRowKeys
+ filterVar, sortPriority, sortMode, first, rows, noDataLabel, selection
}
public Iterator<UIComponent> columns() {
@@ -215,12 +215,12 @@
}
@SuppressWarnings("unchecked")
- public Collection<Object> getSelectedRowKeys() {
- return (Collection<Object>) getStateHelper().eval(PropertyKeys.selectedRowKeys);
+ public Collection<Object> getSelection() {
+ return (Collection<Object>) getStateHelper().eval(PropertyKeys.selection);
}
- public void setSelectedRowKeys(Collection<Object> selectedRowKeys) {
- getStateHelper().put(PropertyKeys.selectedRowKeys, selectedRowKeys);
+ public void setSelection(Collection<Object> selection) {
+ getStateHelper().put(PropertyKeys.selection, selection);
}
public Collection<?> getSortPriority() {
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-06 15:49:47 UTC (rev 17742)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-06 16:45:59 UTC (rev 17743)
@@ -702,8 +702,8 @@
UIDataTableBase table = state.getRow();
writer.startElement(HTML.TR_ELEMENT, table);
StringBuilder builder = new StringBuilder();
- Collection<Object> selectedRowKeys = table.getSelectedRowKeys();
- if (selectedRowKeys != null && selectedRowKeys.contains(table.getRowKey())) {
+ Collection<Object> selection = table.getSelection();
+ if (selection != null && selection.contains(table.getRowKey())) {
builder.append("rf-edt-r-s");
}
if (table.getRowKey().equals(table.getAttributes().get("activeRowKey"))) {
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java 2010-07-06 15:49:47 UTC (rev 17742)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java 2010-07-06 16:45:59 UTC (rev 17743)
@@ -172,16 +172,16 @@
final ClientSelection clientSelection = new ClientSelection(selectionString);
final Map<String, Object> attributes = component.getAttributes();
UIDataTableBase table = (UIDataTableBase) component;
- Collection<Object> selectedRowKeys = table.getSelectedRowKeys();
- if (selectedRowKeys == null) {
- selectedRowKeys = new HashSet<Object>();
+ Collection<Object> selection = table.getSelection();
+ if (selection == null) {
+ selection = new HashSet<Object>();
//TODO nick - model updates should not happen on the 2nd phase
- updateAttribute(context, component, "selectedRowKeys", selectedRowKeys);
+ updateAttribute(context, component, "selection", selection);
}
- final Collection<Object> rowKeys = selectedRowKeys;
+ final Collection<Object> rowKeys = selection;
String selectionFlag = clientSelection.getSelectionFlag();
if (selectionFlag != null) {
- selectedRowKeys.clear();
+ selection.clear();
if (!ClientSelection.FLAG_RESET.equals(selectionFlag)) {
encodeSelectionOutsideCurrentRange(context, table, selectionFlag);
}
@@ -236,7 +236,7 @@
table.setRowKey(context, key);
table.restoreOrigValue(context);
if (newRange != null) {
- final Collection<Object> rowKeys = table.getSelectedRowKeys();
+ final Collection<Object> rowKeys = table.getSelection();
table.walk(context, new DataVisitor() {
public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
rowKeys.add(rowKey);
14 years, 6 months
JBoss Rich Faces SVN: r17742 - in root/ui/iteration/trunk/tables/ui/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2010-07-06 11:49:47 -0400 (Tue, 06 Jul 2010)
New Revision: 17742
Modified:
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java
root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
Log:
RF-8101
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-07-06 14:28:25 UTC (rev 17741)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIDataTableBase.java 2010-07-06 15:49:47 UTC (rev 17742)
@@ -41,7 +41,9 @@
import javax.faces.event.PhaseId;
import javax.faces.event.PreRenderComponentEvent;
+import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.ExtendedDataModel;
+import org.ajax4jsf.model.Range;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.event.FilteringEvent;
@@ -186,6 +188,24 @@
return state;
}
+ /**
+ * Walk ( visit ) this component on all data-aware children for each row from range.
+ *
+ * @param faces
+ * @param visitor
+ * @param range
+ * @param argument
+ */
+ public void walk(FacesContext faces, DataVisitor visitor, Range range, Object argument) {
+ Object key = getRowKey();
+ captureOrigValue(faces);
+
+ getExtendedDataModel().walk(faces, visitor, range, argument);
+
+ setRowKey(faces, key);
+ restoreOrigValue(faces);
+ }
+
public String getFilterVar() {
return (String) getStateHelper().eval(PropertyKeys.filterVar);
}
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-07-06 14:28:25 UTC (rev 17741)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/component/UIExtendedDataTable.java 2010-07-06 15:49:47 UTC (rev 17742)
@@ -32,8 +32,6 @@
import javax.faces.component.visit.VisitResult;
import javax.faces.context.FacesContext;
-import org.ajax4jsf.model.DataVisitor;
-import org.ajax4jsf.model.Range;
import org.richfaces.context.ExtendedVisitContext;
import org.richfaces.context.ExtendedVisitContextMode;
import org.richfaces.log.RichfacesLogger;
@@ -113,24 +111,6 @@
return super.visitDataChildren(visitContext, callback, visitRows);
}
- /**
- * Walk ( visit ) this component on all data-aware children for each row from range.
- *
- * @param faces
- * @param visitor
- * @param range
- * @param argument
- */
- public void walk(FacesContext faces, DataVisitor visitor, Range range, Object argument) {
- Object key = getRowKey();
- captureOrigValue(faces);
-
- getExtendedDataModel().walk(faces, visitor, range, argument);
-
- setRowKey(faces, key);
- restoreOrigValue(faces);
- }
-
protected int getActualFirst() {
return getFirst() + getClientFirst();
}
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-06 14:28:25 UTC (rev 17741)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/ExtendedDataTableRenderer.java 2010-07-06 15:49:47 UTC (rev 17742)
@@ -206,8 +206,8 @@
}
- private static final Map<java.lang.String, org.richfaces.renderkit.ComponentAttribute> EVENT_ATTRIBUTES = Collections
- .unmodifiableMap(ComponentAttribute.createMap(new ComponentAttribute("onselectionchange")
+ private static final Map<java.lang.String, org.richfaces.renderkit.ComponentAttribute> EVENT_ATTRIBUTES
+ = Collections.unmodifiableMap(ComponentAttribute.createMap(new ComponentAttribute("onselectionchange")
.setEventNames(new String[] {"selectionchange"}), new ComponentAttribute("onbeforeselectionchange")
.setEventNames(new String[] {"beforeselectionchange"})));
@@ -262,8 +262,8 @@
boolean columnFacetPresent = table.isColumnFacetPresent(name);
if (columnFacetPresent || "footer".equals(name)) {
writer.startElement(HTML.DIV_ELEM, table);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-edt-" + name.charAt(0), (String) table
- .getAttributes().get(name + "Class")), null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-edt-" + name.charAt(0),
+ (String) table.getAttributes().get(name + "Class")), null);
writer.startElement(HTML.TABLE_ELEMENT, table);
writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
writer.writeAttribute(HTML.CELLSPACING_ATTRIBUTE, "0", null);
@@ -352,7 +352,6 @@
FacesContext context = state.getContext();
ResponseWriter writer = context.getResponseWriter();
UIDataTableBase table = state.getRow();
-
String tableBodyId = table.getClientId(context) + ":b";
EncoderVariance encoderVariance = state.getEncoderVariance();
encoderVariance.encodeStartUpdate(context, tableBodyId);
@@ -360,7 +359,6 @@
writer.writeAttribute(HTML.ID_ATTRIBUTE, tableBodyId, null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-edt-b", null);
if (table.getRowCount() == 0) {
-
UIComponent facet = table.getFacet("noData");
if (facet != null && facet.isRendered()) {
facet.encodeAll(context);
@@ -370,8 +368,6 @@
writer.writeText(noDataLabel, "noDataLabel");
}
}
-
-
} else {
table.getAttributes().put("clientFirst", 0);
writer.startElement(HTML.DIV_ELEM, table);
@@ -391,9 +387,7 @@
writer.writeAttribute(HTML.ID_ATTRIBUTE, table.getClientId(context) + ":body", null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-edt-p rf-edt-pw", null);
}
-
String targetId = table.getClientId(context) + ":tbt" + partName.name().charAt(0);
-
writer.startElement(HTML.TABLE_ELEMENT, table);
writer.writeAttribute(HTML.ID_ATTRIBUTE, targetId, null);
writer.writeAttribute(HTML.CELLPADDING_ATTRIBUTE, "0", null);
@@ -456,7 +450,7 @@
if (oldClientFirst == null) {
oldClientFirst = clientFirst;
}
- int clientRows = ((SequenceRange)table.getComponentState().getRange()).getRows();
+ int clientRows = ((SequenceRange) table.getComponentState().getRange()).getRows();
int difference = clientFirst - oldClientFirst;
SequenceRange addRange = null;
SequenceRange removeRange = null;
@@ -579,7 +573,8 @@
Map<String, Object> attributes = component.getAttributes();
writer.startElement(HTML.DIV_ELEM, component);
writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context), null);
- writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-edt", (String) attributes.get("styleClass")), null);
+ writer.writeAttribute(HTML.CLASS_ATTRIBUTE, HtmlUtil.concatClasses("rf-edt",
+ (String) attributes.get("styleClass")), null);
getUtils().writeAttribute(writer, HTML.STYLE_ATTRIBUTE, attributes.get("style"));
}
@@ -603,7 +598,8 @@
table.restoreOrigValue(context);
}
- protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component)
+ throws IOException {
writer.startElement(HTML.DIV_ELEM, component);
writer.writeAttribute(HTML.ID_ATTRIBUTE, component.getClientId(context) + ":d", null);
writer.writeAttribute(HTML.CLASS_ATTRIBUTE, "rf-edt-d", null);
@@ -636,8 +632,6 @@
writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
writer.endElement(HTML.INPUT_ELEM);
encodeSelectionInput(writer, context, component);
- writer.startElement(HTML.SCRIPT_ELEM, component);
- writer.writeAttribute(HTML.TYPE_ATTR, "text/javascript", null);
JSFunction ajaxFunction = buildAjaxFunction(context, component, AJAX_FUNCTION_NAME);
AjaxEventOptions eventOptions = buildEventOptions(context, component);
Map<String, Object> parameters = eventOptions.getParameters();
@@ -660,8 +654,7 @@
builder.append(",").append(ScriptUtils.toScript(options));
}
builder.append(");");
- writer.write(builder.toString());
- writer.endElement(HTML.SCRIPT_ELEM);
+ utils.writeScript(context, component, builder.toString());
writer.endElement(HTML.DIV_ELEM);
}
@@ -703,7 +696,8 @@
writer.endElement("style");
}
- public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder) throws IOException {
+ public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder)
+ throws IOException {
RendererState state = (RendererState) rowHolder;
UIDataTableBase table = state.getRow();
writer.startElement(HTML.TR_ELEMENT, table);
@@ -818,7 +812,7 @@
if (columnsOrderString != null && columnsOrderString.length() > 0) {
String[] columnsOrder = columnsOrderString.split(",");
updateAttribute(context, component, "columnsOrder", columnsOrder);
- context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); // Use partial re-rendering here.
+ context.getPartialViewContext().getRenderIds().add(component.getClientId(context)); //TODO Use partial re-rendering here.
}
}
Modified: root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java 2010-07-06 14:28:25 UTC (rev 17741)
+++ root/ui/iteration/trunk/tables/ui/src/main/java/org/richfaces/renderkit/SelectionRenderer.java 2010-07-06 15:49:47 UTC (rev 17742)
@@ -35,7 +35,6 @@
import org.ajax4jsf.model.SequenceRange;
import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.richfaces.component.UIDataTableBase;
-import org.richfaces.component.UIExtendedDataTable;
/**
* @author Konstantin Mishin
@@ -180,40 +179,11 @@
updateAttribute(context, component, "selectedRowKeys", selectedRowKeys);
}
final Collection<Object> rowKeys = selectedRowKeys;
- if (clientSelection.getSelectionFlag() != null) {
+ String selectionFlag = clientSelection.getSelectionFlag();
+ if (selectionFlag != null) {
selectedRowKeys.clear();
- if (!ClientSelection.FLAG_RESET.equals(clientSelection.getSelectionFlag())) {
- Object key = table.getRowKey();
- table.captureOrigValue(context);
- SequenceRange range = (SequenceRange) table.getComponentState().getRange();
- SequenceRange newRange = null;
- Object rowKey = attributes.get("shiftRowKey");
- if (rowKey == null) {
- rowKey = attributes.get("activeRowKey");
- attributes.put("shiftRowKey", rowKey);
- }
- table.setRowKey(rowKey);
- int shiftIndex = table.getRowIndex();
- if (ClientSelection.FLAG_ALL.equals(clientSelection.getSelectionFlag())) {
- newRange = new SequenceRange(0, 0);
- } else if (shiftIndex > 0) {
- if (ClientSelection.FLAG_BEFORE_RANGE.equals(clientSelection.getSelectionFlag())) {
- newRange = new SequenceRange(shiftIndex, range.getFirstRow() - shiftIndex);
- } else {
- int last = range.getFirstRow() + range.getRows();
- newRange = new SequenceRange(last, shiftIndex - last + 1);
- }
- }
- table.setRowKey(context, key);
- table.restoreOrigValue(context);
- if (newRange != null) {
- ((UIExtendedDataTable) table).walk(context, new DataVisitor() { //TODO Don't use cast here.
- public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
- rowKeys.add(rowKey);
- return DataVisitResult.CONTINUE;
- }
- }, newRange, null);
- }
+ if (!ClientSelection.FLAG_RESET.equals(selectionFlag)) {
+ encodeSelectionOutsideCurrentRange(context, table, selectionFlag);
}
}
if (clientSelection.isCleanShiftIndex()) {
@@ -238,4 +208,41 @@
}, null);
}
}
+
+
+ private void encodeSelectionOutsideCurrentRange(FacesContext context, UIDataTableBase table, String selectionFlag) { //TODO Rename method
+ Object key = table.getRowKey();
+ table.captureOrigValue(context);
+ SequenceRange range = (SequenceRange) table.getComponentState().getRange();
+ SequenceRange newRange = null;
+ Map<String, Object> attributes = table.getAttributes();
+ Object rowKey = attributes.get("shiftRowKey");
+ if (rowKey == null) {
+ rowKey = attributes.get("activeRowKey");
+ attributes.put("shiftRowKey", rowKey);
+ }
+ table.setRowKey(rowKey);
+ int shiftIndex = table.getRowIndex();
+ if (ClientSelection.FLAG_ALL.equals(selectionFlag)) {
+ newRange = new SequenceRange(0, 0);
+ } else if (shiftIndex > 0) {
+ if (ClientSelection.FLAG_BEFORE_RANGE.equals(selectionFlag)) {
+ newRange = new SequenceRange(shiftIndex, range.getFirstRow() - shiftIndex);
+ } else {
+ int last = range.getFirstRow() + range.getRows();
+ newRange = new SequenceRange(last, shiftIndex - last + 1);
+ }
+ }
+ table.setRowKey(context, key);
+ table.restoreOrigValue(context);
+ if (newRange != null) {
+ final Collection<Object> rowKeys = table.getSelectedRowKeys();
+ table.walk(context, new DataVisitor() {
+ public DataVisitResult process(FacesContext context, Object rowKey, Object argument) {
+ rowKeys.add(rowKey);
+ return DataVisitResult.CONTINUE;
+ }
+ }, newRange, null);
+ }
+ }
}
Modified: root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js
===================================================================
--- root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-07-06 14:28:25 UTC (rev 17741)
+++ root/ui/iteration/trunk/tables/ui/src/main/resources/META-INF/resources/extendedDataTable.js 2010-07-06 15:49:47 UTC (rev 17742)
@@ -258,7 +258,7 @@
bodyJQuery.bind("scroll", bodyScrollListener);
if (options.selectionMode != "none") {
tbodies.bind("click", selectionClickListener);
- bodyJQuery.bind("keydown", selectionKeyDownListener);
+ bodyJQuery.bind(window.opera ? "keypress" : "keydown", selectionKeyDownListener);
initializeSelection();
}
} else {
@@ -377,12 +377,22 @@
window.clearTimeout(timeoutId);
timeoutId = null;
}
- if (this.scrollTop < spacerElement.offsetHeight || this.scrollTop + this.clientHeight > spacerElement.offsetHeight + dataTableElement.offsetHeight) {
+ if (Math.max(this.scrollTop - rowHeight, 0) < spacerElement.offsetHeight
+ || Math.min(this.scrollTop + rowHeight + this.clientHeight, this.scrollHeight) > spacerElement.offsetHeight + dataTableElement.offsetHeight) {
timeoutId = window.setTimeout(function (event) {loadData(event)}, 1000);
}
};
- var selectRow = function (index) {
+ var showActiveRow = function() {
+ if (bodyElement.scrollTop > activeIndex * rowHeight + spacerElement.offsetHeight) { //UP
+ bodyElement.scrollTop = Math.max(bodyElement.scrollTop - rowHeight, 0);
+ } else if (bodyElement.scrollTop + bodyElement.clientHeight
+ < (activeIndex + 1) * rowHeight + spacerElement.offsetHeight) { //DOWN
+ bodyElement.scrollTop = Math.min(bodyElement.scrollTop + rowHeight, bodyElement.scrollHeight - bodyElement.clientHeight);
+ }
+ }
+
+ var selectRow = function(index) {
ranges.add(index);
for ( var i = 0; i < tbodies.length; i++) {
jQuery(tbodies[i].rows[index]).addClass("rf-edt-r-s");
@@ -456,6 +466,9 @@
}
var selectRows = function(range) {
+ if (typeof range == "number") {
+ range = [range, range];
+ }
var changed;
var i = 0;
for (; i < range[0]; i++) {
@@ -507,6 +520,7 @@
}
if (activeIndex != index) {
setActiveRow(index);
+ showActiveRow();
}
if (changed) {
writeSelection();
@@ -535,7 +549,7 @@
var index = tr.rowIndex;
if (options.selectionMode == "single" || (options.selectionMode != "multipleKeyboardFree"
&& !event.shiftKey && !event.ctrlKey)) {
- changed = selectRows([index, index]);
+ changed = selectRows(index);
} else if (options.selectionMode == "multipleKeyboardFree" || (!event.shiftKey && event.ctrlKey)) {
if (ranges.contains(index)) {
deselectRow(index);
@@ -556,24 +570,26 @@
selectionFlag = "a";
onselectionchange(event, activeIndex, true); //TODO Is there a way to know that selection haven't changed?
event.preventDefault();
- }
- if (typeof activeIndex == "number") {
+ } else {
var index;
- if (event.keyCode == 38 && activeIndex) { //UP
- index = activeIndex - 1;
- } else if (event.keyCode == 40 && activeIndex < rows - 1) { //DOWN
- index = activeIndex + 1;
+ if (event.keyCode == 38) { //UP
+ index = -1;
+ } else if (event.keyCode == 40) { //DOWN
+ index = 1;
}
if (index != null && onbeforeselectionchange(event)) {
- var changed;
- if (options.selectionMode == "single" || (!event.shiftKey && !event.ctrlKey)) {
- changed = selectRows([index, index]);
- } else if (event.shiftKey) {
- changed = processSlectionWithShiftKey(index);
+ if (typeof activeIndex == "number") {
+ index += activeIndex;
+ if (index >= 0 && index < rows ) {
+ var changed;
+ if (options.selectionMode == "single" || (!event.shiftKey && !event.ctrlKey)) {
+ changed = selectRows(index);
+ } else if (event.shiftKey) {
+ changed = processSlectionWithShiftKey(index);
+ }
+ onselectionchange(event, index, changed);
+ }
}
- setActiveRow(index);
- //showRow
- onselectionchange(event, index, changed);
event.preventDefault();
}
}
14 years, 6 months
JBoss Rich Faces SVN: r17741 - management/design-4x/panelBar.
by richfaces-svn-commits@lists.jboss.org
Author: admitriev
Date: 2010-07-06 10:28:25 -0400 (Tue, 06 Jul 2010)
New Revision: 17741
Added:
management/design-4x/panelBar/panelBar.html
Log:
Added: management/design-4x/panelBar/panelBar.html
===================================================================
--- management/design-4x/panelBar/panelBar.html (rev 0)
+++ management/design-4x/panelBar/panelBar.html 2010-07-06 14:28:25 UTC (rev 17741)
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+
+<html>
+<head>
+ <title>Untitled</title>
+<style>
+
+.pb_container {width : 300px /*visible modal panel width*/; border : 1px solid #a6a6a6 /*panelBorderColor*/; background : #FFFFFF /*generalBackgroundColor*/;}
+.pb_label { border-bottom : 1px solid #a6a6a6 /*panelBorderColor*/; background : url(images/bg_header.png) /*from headerGradientColor to headerBackgroundColor, picture height 20px*/ repeat-x top left #C0D1E7 /*headerBackgroundColor*/; position : relative; padding-right : 20px; padding-left : 10px; padding-bottom : 7px;}
+.pb_label_last { border-bottom : 0px;}
+.pb_label_content {padding-top : 8px; font-weight : bold /*headerWeightFont*/; color : #000000 /*headerTextColor*/; font-family : verdana /*headerFamilyFont*/; font-size : 11px /*headerSizeFont*/;}
+
+.pb_content_scroller { border-bottom : 1px solid #a6a6a6 /*panelBorderColor*/; height : 100px/*visible modal panel height minus header height*/; position : relative; overflow : auto; overflow-x : hidden;}
+.pb_content {position : relative; padding : 10px; color : #000000 /*generalTextColor*/; font-family : verdana /*generalFamilyFont*/; font-size : 11px /*generalSizeFont*/;}
+
+
+</style>
+</head>
+
+<body style="margin : 30px">
+
+ <div class="pb_container">
+ <div class="pb_label">
+ <div class="pb_label_content">
+ Level 1
+ </div>
+ </div>
+ <div class="pb_label">
+ <div class="pb_label_content">
+ Level 2
+ </div>
+ </div>
+ <div class="pb_label">
+ <div class="pb_label_content">
+ Level 3
+ </div>
+ </div>
+ <div class="pb_label">
+ <div class="pb_label_content">
+ Level 4
+ </div>
+ </div>
+ <div class="pb_content_scroller">
+ <div class="pb_content">
+ Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here. Content will be here.
+ </div>
+ </div>
+ <div class="pb_label pb_label_last">
+ <div class="pb_label_content">
+ Level 5
+ </div>
+ </div>
+ </div>
+
+
+
+
+
+</body>
+</html>
14 years, 6 months
JBoss Rich Faces SVN: r17739 - root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script.
by richfaces-svn-commits@lists.jboss.org
Author: pyaschenko
Date: 2010-07-06 09:53:39 -0400 (Tue, 06 Jul 2010)
New Revision: 17739
Modified:
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js
root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
Log:
https://jira.jboss.org/browse/RF-8875
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js 2010-07-06 13:07:51 UTC (rev 17738)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/ComboBox.js 2010-07-06 13:53:39 UTC (rev 17739)
@@ -52,7 +52,7 @@
this.options = {};
// call constructor of parent class
$super.constructor.call(this, componentId+ID.SELECT, fieldId, options);
- $p.attachToDom(componentId);
+ $p.attachToDom.call(this, componentId);
this.componentId = componentId;
this.options = $.extend(this.options, defaultOptions, options);
//this.currentValue = rf.getDomElement(this.fieldId).value;
@@ -84,7 +84,7 @@
};
var onMouseOver = function(event) {
- console && console.log && console.log("mouseOver");
+ //console && console.log && console.log("mouseOver");
var element = event.target;
while (element.parentNode && element.parentNode!=event.currentTarget) {
element = element.parentNode;
@@ -138,7 +138,7 @@
};
// Add new properties and methods
- $.extend(rf.ui.SelectBase.prototype, (function () {
+ $.extend(rf.ui.ComboBox.prototype, (function () {
return {
name:"CompoBox",
destroy: function () {
Modified: root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js
===================================================================
--- root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 13:07:51 UTC (rev 17738)
+++ root/ui-sandbox/inputs/trunk/combobox/src/main/resources/META-INF/resources/script/SelectBase.js 2010-07-06 13:53:39 UTC (rev 17739)
@@ -88,17 +88,17 @@
};
var onSelectMouseDown = function () {
this.isMouseDown = true;
- console && console.log && console.log("onMouseDown");
+ //console && console.log && console.log("onMouseDown");
};
var onSelectMouseUp = function () {
//this.isMouseDown = false;
rf.getDomElement(this.fieldId).focus();
- console && console.log && console.log("onMouseUp");
+ //console && console.log && console.log("onMouseUp");
};
var onButtonShow = function (event) {
this.isMouseDown = true;
- console && console.log && console.log("onButtonShow - "+this.timeoutId);
+ //console && console.log && console.log("onButtonShow - "+this.timeoutId);
if (this.timeoutId) {
window.clearTimeout(this.timeoutId);
this.timeoutId = null;
@@ -114,15 +114,15 @@
};
var onFocus = function (event) {
- console && console.log && console.log("onFocus");
+ //console && console.log && console.log("onFocus");
};
var onBlur = function (event) {
- console && console.log && console.log("onBlur");
+ //console && console.log && console.log("onBlur");
if (this.isMouseDown) {
rf.getDomElement(this.fieldId).focus();
this.isMouseDown = false;
- console && console.log && console.log("---------> and focus");
+ //console && console.log && console.log("---------> and focus");
} else if (this.isVisible && !this.isMouseDown/*&& checkOnBlur.call(this, event)*/) {
var _this = this;
this.timeoutId = window.setTimeout(function(){_this.hide();}, 200);
14 years, 6 months
JBoss Rich Faces SVN: r17738 - root/ui/core/trunk/ui/src/main/java/org/richfaces/resource.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 09:07:51 -0400 (Tue, 06 Jul 2010)
New Revision: 17738
Modified:
root/ui/core/trunk/ui/src/main/java/org/richfaces/resource/PushResource.java
Log:
Fixed compilation error in PushResource
Modified: root/ui/core/trunk/ui/src/main/java/org/richfaces/resource/PushResource.java
===================================================================
--- root/ui/core/trunk/ui/src/main/java/org/richfaces/resource/PushResource.java 2010-07-06 12:58:11 UTC (rev 17737)
+++ root/ui/core/trunk/ui/src/main/java/org/richfaces/resource/PushResource.java 2010-07-06 13:07:51 UTC (rev 17738)
@@ -81,7 +81,7 @@
FacesContext facesContext = FacesContext.getCurrentInstance();
ResourceCodec resourceCodec = ServiceTracker.getService(ResourceCodec.class);
- String requestPath = resourceCodec.encodeResourceRequestPath(facesContext, getResourceName(), null, null);
+ String requestPath = resourceCodec.encodeResourceRequestPath(facesContext, null, getResourceName(), null, null);
return resourceCodec.encodeJSFMapping(facesContext, requestPath);
}
14 years, 6 months
JBoss Rich Faces SVN: r17737 - in root/core/trunk/impl: src/main/java/org/richfaces/resource and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 08:58:11 -0400 (Tue, 06 Jul 2010)
New Revision: 17737
Modified:
root/core/trunk/impl/pom.xml
root/core/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
root/core/trunk/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/DefaultSkinImpl.java
root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java
root/core/trunk/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
Log:
Added libraryName support for resources
CompiledCSSResource changed to use ResourceHandler
Hash code computation optimization in skins
Modified: root/core/trunk/impl/pom.xml
===================================================================
--- root/core/trunk/impl/pom.xml 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/pom.xml 2010-07-06 12:58:11 UTC (rev 17737)
@@ -56,6 +56,10 @@
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ </dependency>
<!-- Provided Dependencies -->
<dependency>
Modified: root/core/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/resource/CompiledCSSResource.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -31,6 +31,7 @@
import javax.faces.application.ProjectStage;
import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
import javax.faces.context.FacesContext;
import org.richfaces.log.RichfacesLogger;
@@ -51,63 +52,27 @@
*/
public class CompiledCSSResource extends AbstractCacheableResource implements StateHolderResource {
- private static final String ECSS = ".ecss";
-
- private static final String CLASSPATH_BASE_PATH = "META-INF/resources/";
-
- private static final String WEBAPP_BASE_PATH = "/resources/";
-
private static final Logger LOGGER = RichfacesLogger.RESOURCE.getLogger();
private static final String NULL_STYLESHEET = "Parsed stylesheet for ''{0}'':''{1}'' resource is null.";
- private String resourcePath;
-
- public CompiledCSSResource(String resourcePath) {
- this.resourcePath = resourcePath;
+ private ResourceHandler defaultHandler;
+
+ public CompiledCSSResource(String resourceName, String libraryName, ResourceHandler defaultHandler) {
+ setResourceName(resourceName);
+ setLibraryName(libraryName);
+ this.defaultHandler = defaultHandler;
}
- @Override
- public String getResourceName() {
- return this.resourcePath;
- }
-
public InputStream getResourceInputStream() throws IOException {
- String path = null;
- if (this.resourcePath.indexOf(ECSS) != -1) {
- path = this.resourcePath.substring(0, this.resourcePath.lastIndexOf(ECSS) + ECSS.length());
- } else {
- LOGGER.error("This resource is not properly dynamic resource : " + getResourceName());
+ Resource resource = defaultHandler.createResource(getResourceName(), getLibraryName(), "text/plain");
+ if (resource == null) {
return null;
}
- InputStream in = null;
- try {
- in = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream(WEBAPP_BASE_PATH + path);
- } catch (Exception e) {
- // Normal situation, resource not found in webapp resources
- }
- if (in != null) {
- return in;
- }
- ClassLoader loader = getClassLoader();
- in = loader.getResourceAsStream(CLASSPATH_BASE_PATH + path);
- if (in == null) {
- // try using this class' loader (necessary when running in OSGi)
- in = this.getClass().getClassLoader().getResourceAsStream(CLASSPATH_BASE_PATH + path);
- }
- return in;
-
+ return resource.getInputStream();
}
- public static ClassLoader getCurrentLoader(Object fallbackClass) {
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- if (loader == null) {
- loader = fallbackClass.getClass().getClassLoader();
- }
- return loader;
- }
-
@Override
public InputStream getInputStream() throws IOException {
FacesContext ctx = FacesContext.getCurrentInstance();
Modified: root/core/trunk/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/resource/DefaultResourceCodec.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -98,6 +98,19 @@
sb.append(Util.encodeURIQueryPart(encodedResourceData));
}
+ if (libraryName != null && libraryName.length() != 0) {
+ if (!parameterAppended) {
+ sb.append('?');
+ parameterAppended = true;
+ } else {
+ sb.append('&');
+ }
+
+ sb.append(LIBRARY_NAME_PARAM);
+ sb.append('=');
+ sb.append(Util.encodeURIQueryPart(libraryName));
+ }
+
return sb.toString();
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/resource/ResourceHandlerImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -201,7 +201,8 @@
}
if (resourceName.lastIndexOf(".ecss") != -1) {
- resource = new CompiledCSSResource(resourceName);
+ String libraryName = resourceCodec.decodeLibraryName(context, resourcePath);
+ resource = new CompiledCSSResource(resourceName, libraryName, defaultHandler);
}
if (resource == null) {
@@ -454,18 +455,18 @@
Map<String, String> params = Util.parseResourceParameters(resourceName);
resourceName = extractParametersFromResourceName(resourceName);
if (resourceName.lastIndexOf(".ecss") != -1) {
- result = new CompiledCSSResource(resourceName);
+ //TODO nick - params?
+ result = new CompiledCSSResource(resourceName, libraryName, defaultHandler);
} else {
//TODO nick - libraryName as package name?
if ((resourceName != null) && ((libraryName == null) || (libraryName.length() == 0))) {
result = createHandlerDependentResource(resourceName, params);
}
-
- if (result == null) {
- result = defaultHandler.createResource(resourceName, libraryName, contentType);
- }
}
-
+ if (result == null) {
+ result = defaultHandler.createResource(resourceName, libraryName, contentType);
+ }
+
return result;
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/AbstractChainableSkinImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -21,12 +21,13 @@
package org.richfaces.skin;
-import org.ajax4jsf.Messages;
+import java.util.Map;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
-import java.util.Map;
+import org.ajax4jsf.Messages;
+
/**
* @author nick belaevski
* @since 3.2
@@ -58,7 +59,7 @@
}
};
- AbstractChainableSkinImpl(Map properties) {
+ AbstractChainableSkinImpl(Map<Object, Object> properties) {
super(properties);
}
@@ -134,8 +135,8 @@
}
@Override
- protected int computeHashCode(FacesContext context) {
- int hash = super.computeHashCode(context);
+ public int hashCode(FacesContext context) {
+ int hash = super.hashCode(context);
Skin baseSkin = getBaseSkin(context);
if (baseSkin != null) {
@@ -144,7 +145,7 @@
return hash;
}
-
+
private abstract static class Operation {
public Object doChainedCall(FacesContext context, AbstractChainableSkinImpl impl, String name,
int[] singleInt) {
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/BaseSkinImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -21,9 +21,10 @@
package org.richfaces.skin;
-import javax.faces.context.FacesContext;
import java.util.Map;
+import javax.faces.context.FacesContext;
+
/**
* @author nick belaevski
* @since 3.2
@@ -33,7 +34,7 @@
private SkinFactoryImpl factoryImpl;
- BaseSkinImpl(Map properties, SkinFactoryImpl factory) {
+ BaseSkinImpl(Map<Object, Object> properties, SkinFactoryImpl factory) {
super(properties);
this.factoryImpl = factory;
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/BasicSkinImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -22,14 +22,10 @@
package org.richfaces.skin;
import java.awt.Color;
-import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import javax.el.Expression;
import javax.el.ValueExpression;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.ajax4jsf.util.HtmlColor;
@@ -42,20 +38,23 @@
* @version $Revision: 1.1.2.1 $ $Date: 2007/01/09 18:59:41 $
*/
public abstract class BasicSkinImpl implements Skin {
+
public static final String RENDER_KIT_PARAMETER = "render.kit";
- public static final String REQUEST_HASH_CODES_MAP_PARAMETER = "org.ajax4jsf.skin.HASH_CODES_MAP";
- private Map<String, Object> skinParams = new HashMap<String, Object>();
+
+ private int hashCode = 0;
+
+ private final Map<Object, Object> skinParams;
/**
* Skin can instantiate only by factory method.
*
* @param skinName
*/
- BasicSkinImpl(Map properties) {
+ BasicSkinImpl(Map<Object, Object> properties) {
this.skinParams = properties;
}
- protected Map<String, Object> getSkinParams() {
+ protected Map<Object, Object> getSkinParams() {
return skinParams;
}
@@ -141,17 +140,30 @@
}
protected int computeHashCode(FacesContext context) {
- int hash = 0;
+ int localHash = hashCode;
+ if (localHash == 0) {
+ boolean hasDynamicValues = false;
- for (Iterator iter = skinParams.keySet().iterator(); iter.hasNext();) {
- String key = (String) iter.next();
- Object parameter = getLocalParameter(context, key);
+ for (Map.Entry<Object, Object> entry : skinParams.entrySet()) {
+ String key = (String) entry.getKey();
+ Object value = entry.getValue();
+
+ if (value instanceof Expression) {
+ hasDynamicValues = true;
+ }
+
+ Object parameter = getValueReference(context, value);
- hash = 31 * hash + key.hashCode();
- hash = 31 * hash + ((parameter != null) ? parameter.hashCode() : 0);
+ localHash = 31 * localHash + key.hashCode();
+ localHash = 31 * localHash + ((parameter != null) ? parameter.hashCode() : 0);
+ }
+
+ if (!hasDynamicValues) {
+ hashCode = localHash;
+ }
}
- return hash;
+ return localHash;
}
/*
@@ -159,26 +171,19 @@
* @see org.richfaces.skin.Skin#hashCode(javax.faces.context.FacesContext)
*/
public int hashCode(FacesContext context) {
- ExternalContext externalContext = context.getExternalContext();
- Map<String, Object> requestMap = externalContext.getRequestMap();
- ConcurrentMap<Skin, Integer> map;
-
- synchronized (requestMap) {
- map = (ConcurrentMap<Skin, Integer>) requestMap.get(REQUEST_HASH_CODES_MAP_PARAMETER);
-
- if (map == null) {
- map = new ConcurrentHashMap<Skin, Integer>();
- requestMap.put(REQUEST_HASH_CODES_MAP_PARAMETER, map);
- }
+ if (hashCode != 0) {
+ return hashCode;
}
+
+ Map<Object, Object> attributesMap = context.getAttributes();
+
+ Integer requestCode = (Integer) attributesMap.get(this);
- Integer requestCode = (Integer) map.get(this);
-
if (null == requestCode) {
requestCode = new Integer(computeHashCode(context));
// store hash for this skin as request-skope parameter - not calculate on next calls for same request
- map.putIfAbsent(this, requestCode);
+ attributesMap.put(this, requestCode);
}
return requestCode.intValue();
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/DefaultSkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/DefaultSkinImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/DefaultSkinImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -21,15 +21,17 @@
package org.richfaces.skin;
-import javax.faces.context.FacesContext;
import java.util.Map;
+import javax.faces.context.FacesContext;
+
/**
* @author nick belaevski
* @since 3.2
*/
public class DefaultSkinImpl extends AbstractChainableSkinImpl {
- DefaultSkinImpl(Map properties) {
+
+ DefaultSkinImpl(Map<Object, Object> properties) {
super(properties);
}
Modified: root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java
===================================================================
--- root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/main/java/org/richfaces/skin/SkinImpl.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -21,9 +21,10 @@
package org.richfaces.skin;
-import javax.faces.context.FacesContext;
import java.util.Map;
+import javax.faces.context.FacesContext;
+
/**
* @author nick belaevski
* @since 3.2
@@ -32,7 +33,7 @@
private SkinFactoryImpl factoryImpl;
- SkinImpl(Map properties, SkinFactoryImpl factoryImpl) {
+ SkinImpl(Map<Object, Object> properties, SkinFactoryImpl factoryImpl) {
super(properties);
this.factoryImpl = factoryImpl;
Modified: root/core/trunk/impl/src/test/java/org/richfaces/skin/SkinTestCase.java
===================================================================
--- root/core/trunk/impl/src/test/java/org/richfaces/skin/SkinTestCase.java 2010-07-06 12:54:22 UTC (rev 17736)
+++ root/core/trunk/impl/src/test/java/org/richfaces/skin/SkinTestCase.java 2010-07-06 12:58:11 UTC (rev 17737)
@@ -249,19 +249,20 @@
});
Skin skin = factory.getSkin(facesContext);
- Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+ Map<Object, Object> attributesMap = facesContext.getAttributes();
// test properties
int hash = skin.hashCode(facesContext);
- assertTrue(requestMap.containsKey(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER));
+ assertTrue(attributesMap.containsKey(skin));
assertEquals(hash, skin.hashCode(facesContext));
- requestMap.remove(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER);
+ attributesMap.remove(skin);
assertEquals(hash, skin.hashCode(facesContext));
// setup Value binding mock for different value - hash must differ.
- requestMap.remove(BasicSkinImpl.REQUEST_HASH_CODES_MAP_PARAMETER);
+ attributesMap.remove(skin);
+ Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
Map map = (Map) requestMap.get("test");
map.put("bean", "other.test.value");
14 years, 6 months
JBoss Rich Faces SVN: r17736 - root/commons/trunk/api/src/main/java/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-07-06 08:54:22 -0400 (Tue, 06 Jul 2010)
New Revision: 17736
Modified:
root/commons/trunk/api/src/main/java/org/richfaces/MethodMetadata.java
Log:
Added TODOs to MethodMetadata class
Modified: root/commons/trunk/api/src/main/java/org/richfaces/MethodMetadata.java
===================================================================
--- root/commons/trunk/api/src/main/java/org/richfaces/MethodMetadata.java 2010-07-06 12:33:13 UTC (rev 17735)
+++ root/commons/trunk/api/src/main/java/org/richfaces/MethodMetadata.java 2010-07-06 12:54:22 UTC (rev 17736)
@@ -33,12 +33,14 @@
* @author akolonitsky
* @since Feb 24, 2010
*/
+//TODO nick - handle return type
public abstract class MethodMetadata extends Metadata {
- protected final Class[] signature;
+
+ protected final Class<?>[] signature;
protected final TagAttribute attribute;
- public MethodMetadata(TagAttribute attribute, Class ... signature) {
+ public MethodMetadata(TagAttribute attribute, Class<?> ... signature) {
this.attribute = attribute;
this.signature = signature;
}
14 years, 6 months
JBoss Rich Faces SVN: r17735 - in management/design-4x/boxes: images and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: admitriev
Date: 2010-07-06 08:33:13 -0400 (Tue, 06 Jul 2010)
New Revision: 17735
Modified:
management/design-4x/boxes/combo_box.html
management/design-4x/boxes/images/bg_shadow.png
management/design-4x/boxes/suggestion_box.html
Log:
Modified: management/design-4x/boxes/combo_box.html
===================================================================
--- management/design-4x/boxes/combo_box.html 2010-07-06 12:29:02 UTC (rev 17734)
+++ management/design-4x/boxes/combo_box.html 2010-07-06 12:33:13 UTC (rev 17735)
@@ -6,8 +6,8 @@
<style>
* {font-size : 11px; font-family : verdana; color : #000000}
-.cb_field_width{ width : 150px;}
-.cb_list_width{ width : 250px;}
+.cb_field_width{ width : 100px;}
+.cb_list_width{ width : 200px;}
.cb_list_height{ height : 100px;}
.cb_font{color : #000000/*generalTextColor*/}
@@ -19,13 +19,16 @@
.cb_button_arrow{ background : url(images/down.gif) center no-repeat; cursor : pointer;}
.cb_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
-.cb_list_position{ position : absolute; top: 0px; left: -1px; }
.cb_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
.cb_list_scroll{ overflow : auto; overflow-x : hidden;}
.cb_option{ padding : 2px; white-space : nowrap; cursor : default;}
.cb_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
-.cb_list_shadow{ position : absolute; width : 260px; height : 109px; margin-left : -4px; margin-top : -2px;}
+.cb_shadow {border: 0px solid red; display: inline-block; position: absolute; float : left; padding : 6px 6px 6px 6px; top : -6px; left : -7px;}
+.cb_shadow_t {background: url(images/bg_shadow.png) top left; position: absolute; width: 6px; top: 0px; bottom: 6px; left : 0px}
+.cb_shadow_l {background: url(images/bg_shadow.png) bottom left; position: absolute; height: 6px; bottom: 0px; left: 0px; right: 6px;}
+.cb_shadow_r {background: url(images/bg_shadow.png) bottom right; position: absolute; width: 6px; top: 6px; bottom: 0px; right: 0px;}
+.cb_shadow_b {background: url(images/bg_shadow.png) right top; position: absolute; height: 6px; top: 0px; left: 6px; right: 0px;}
</style>
</head>
@@ -43,10 +46,15 @@
</div>
<div class="cb_list_cord">
- <img src="images/bg_shadow.png" class="cb_list_shadow">
- <div class="cb_list_position cb_list_width">
+
+ <div class="cb_shadow">
+ <div class="cb_shadow_t"></div>
+ <div class="cb_shadow_l"></div>
+ <div class="cb_shadow_r"></div>
+ <div class="cb_shadow_b"></div>
+
<div class="cb_list_decoration">
- <div class="cb_list_scroll cb_list_height">
+ <div class="cb_list_scroll cb_list_width cb_list_height">
<div class="cb_option cb_font">Option 1</div>
<div class="cb_option cb_font">Option 2</div>
<div class="cb_option cb_font">Option 3</div>
@@ -59,8 +67,8 @@
</div>
</div>
</div>
+
</div>
-
</div>
text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block text block
Modified: management/design-4x/boxes/images/bg_shadow.png
===================================================================
(Binary files differ)
Modified: management/design-4x/boxes/suggestion_box.html
===================================================================
--- management/design-4x/boxes/suggestion_box.html 2010-07-06 12:29:02 UTC (rev 17734)
+++ management/design-4x/boxes/suggestion_box.html 2010-07-06 12:33:13 UTC (rev 17735)
@@ -13,14 +13,17 @@
.sb_font{color : #000000/*generalTextColor*/}
-.sb_list_cord{ position : relative; font-size : 0px;d@isplay : none;}/*DDL is not hidden!!!!!*/
-.sb_list_position{ position : absolute; top: 0px; left: -1px; }
-.sb_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; position : absolute; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
+.sb_list_cord{ position : relative; font-size : 0px;d@isplay : none}/*DDL is hidden!!!!!*/
+.sb_list_decoration{ border : 1px solid #A6A6A6 /*panelBorderColor*/; padding : 0px; background : #FFFFFF; /*tableBackgroundColor*/}
.sb_list_scroll{ overflow : auto; overflow-x : hidden;}
.sb_option{ padding : 2px; white-space : nowrap; cursor : default;}
.sb_select{ padding : 1px; width : 100%; background-color: #DFE8F6; border : 1px dotted #a3bae9;/*generalTextColor*/}
-.sb_shadow{ position : absolute; width : 260px; height : 109px; margin-left : -4px; margin-top : -2px;}
+.sb_shadow {border: 0px solid red; display: inline-block; position: absolute; float : left; padding : 6px 6px 6px 6px; top : -8px; left : -5px;}
+.sb_shadow_t {background: url(images/bg_shadow.png) top left; position: absolute; width: 6px; top: 0px; bottom: 6px; left : 0px}
+.sb_shadow_l {background: url(images/bg_shadow.png) bottom left; position: absolute; height: 6px; bottom: 0px; left: 0px; right: 6px;}
+.sb_shadow_r {background: url(images/bg_shadow.png) bottom right; position: absolute; width: 6px; top: 6px; bottom: 0px; right: 0px;}
+.sb_shadow_b {background: url(images/bg_shadow.png) right top; position: absolute; height: 6px; top: 0px; left: 6px; right: 0px;}
</style>
</head>
@@ -33,10 +36,15 @@
<input type="Text" value="Parent element">
<div class="sb_list_cord">
- <div class="sb_list_position sb_list_width">
- <img src="images/bg_shadow.png" class="sb_shadow">
+
+ <div class="sb_shadow">
+ <div class="sb_shadow_t"></div>
+ <div class="sb_shadow_l"></div>
+ <div class="sb_shadow_r"></div>
+ <div class="sb_shadow_b"></div>
+
<div class="sb_list_decoration">
- <div class="sb_list_scroll sb_list_height sb_list_width">
+ <div class="sb_list_scroll sb_list_width sb_list_height">
<div class="sb_option sb_font">Option 1</div>
<div class="sb_option sb_font">Option 2</div>
<div class="sb_option sb_font">Option 3</div>
@@ -49,6 +57,7 @@
</div>
</div>
</div>
+
</div>
</div>
14 years, 6 months