JBoss Rich Faces SVN: r5314 - in trunk/ui/scrollableDataTable/src/main: javascript/ClientUI/common/utils and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-01-11 13:10:58 -0500 (Fri, 11 Jan 2008)
New Revision: 5314
Modified:
trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
Log:
merged scrollable-data-table with 3/1/x branch
Modified: trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
--- trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-11 18:10:58 UTC (rev 5314)
@@ -93,12 +93,13 @@
int curentRow = getFirst();
+ int rows;
if(reqRowsCount == -1 ){
- reqRowsCount = getRows();
+ rows = getRows();
+ } else {
+ rows = reqRowsCount;
}
-
- int rows = reqRowsCount;
-
+
int rowsCount = getExtendedDataModel().getRowCount();
if(rows > 0){
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/common/utils/Utils.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -60,15 +60,15 @@
target.parentNode.replaceChild(imported, target);;
return imported;
- } else if (ClientUILib.isGecko){
- //Mozill family
- var theDoc = document;
-
- Utils.DOM._clearAttributes(target);
- Utils.DOM.copyAttributes(target, src);
-
- target.innerHTML = src.innerHTML;//nnerHTML.join("");
- return target;
+// } else if (ClientUILib.isGecko){
+// //Mozill family
+// var theDoc = document;
+//
+// Utils.DOM._clearAttributes(target);
+// Utils.DOM.copyAttributes(target, src);
+//
+// target.innerHTML = src.innerHTML;//nnerHTML.join("");
+// return target;
} else {
//Fall back to DOM, and cross the fingers
src = document.importNode(src, true);
@@ -299,6 +299,12 @@
}
};
+Utils.trace = function(s) {
+ LOG.info(s + ": " + (new Date().getTime()- this._d) + " ");
+ //window.status = s + ": " + (new Date().getTime()- this._d) + " " + window.status;
+ this._d = new Date().getTime();
+};
+
Array.prototype.unbreakableEach = function(f) {
for (var i = 0; i < this.length; i++) {
f(this[i], i);
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/Grid.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -71,31 +71,19 @@
var grid = this;
Utils.execOnLoad(
function(){
+ grid.getHeader().updateSize();
+ grid.getBody().updateSize();
+ if(grid.getFooter()) {grid.getFooter().updateSize();}
grid.updateLayout();
},
Utils.Condition.ElementPresent(grid.client_id), 100);
},
updateLayout: function($super) {
- if(!this.controlCreated || this.getHeight()==0) {
- return;
- }
$super();
-
- var header = this.getHeader();
- if(header.getHeight() == 0) {
- header.updateSize();
- this.getBody().updateSize();
- if(this.getFooter()) {this.getFooter().updateSize();}
- }
-
if(this.layout) {
this.layout.updateLayout();
}
- header.updateLayout();
- header.setFakeColumnWidth();
- this.getBody().setFakeColumnWidth();
- if(this.getFooter()) {this.getFooter().setFakeColumnWidth();}
},
getHeader: function() {
return this.layout.getPane(GridLayout_Enum.HEADER);
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridBody.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -51,8 +51,8 @@
window.loadingInvalidateTime = (new Date()).getTime();
},
_onContentVScroll: function(event) {
- this.helpObject1.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
- this.helpObject2.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+ this.helpObject1.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight + 5);
+ this.helpObject2.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight + 5);
this.setScrollPos(event.memo.pos);
this.adjustDataPosition(event.memo.pos);
},
@@ -174,15 +174,14 @@
},
updateSize: function() {
- var defHeight = this._calcDefaultRowHeight();
-
- if (isFinite(defHeight)) {
- this.defaultRowHeight = defHeight;
- }
-
var row = this.templNormal.getElement().rows[0];
if(row) {
this.defaultRowHeight = row.cells[0].offsetHeight;
+ } else {
+ var defHeight = this._calcDefaultRowHeight();
+ if (isFinite(defHeight)) {
+ this.defaultRowHeight = defHeight;
+ }
}
//if(ClientUILib.isGecko) {
// this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
@@ -206,7 +205,7 @@
this.scrollBox.setHeight(height);
var scrollLeft = this.grid.getScrollOffset();
- var fixH = this.grid.getFooter() ? this.grid.getFooter().getHeight() : 0;
+ var fixH = this.grid.getFooter() ? this.grid.getFooter().element.offsetHeight : 0;
if(fixH > height) fixH = 0;
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -229,10 +228,10 @@
this.defaultRowHeight = this._calcDefaultRowHeight();
this.scrollBox.hide();
this.sizeBox.setHeight(this.defaultRowHeight * this.grid.dataModel.getCount() + fixH);
- this.helpObject1.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
- this.helpObject2.moveToY(this.sizeBox.getHeight()+ this.defaultRowHeight + 5);
+ this.helpObject1.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight + 5);
+ this.helpObject2.moveToY(this.sizeBox.element.offsetHeight+ this.defaultRowHeight + 5);
- this.dataVisible = parseInt(this.contentBox.getHeight() / this.defaultRowHeight, 10) + 1;
+ this.dataVisible = parseInt(this.contentBox.element.offsetHeight / this.defaultRowHeight, 10) + 1;
this.dataVisible = Math.min(this.dataVisible, this.rowsCount);
if(height > 0) {
this.adjustDataPosition(this.currentPos);
@@ -249,6 +248,7 @@
}
var scrollPos = Math.min(totalWidth - viewWidth, scrollLeft);
this.grid.adjustScrollPosition(scrollPos);
+ this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
this.templNormal.moveToX(-pos);
@@ -370,21 +370,20 @@
}
if(switchType === 0) {
- startRowIndx = this._getRowIndex(this.templFrozen.getElement().rows[0].id);
+ startRowIndx = this._getRowIndex(this.templNormal.getElement().rows[0].id);
startIndex = range.start;
countToLoad = range.end - range.start;
}
else {
var i, row, rownew, cloned;
countToLoad = 0;
- var frozenTbl = this.templFrozen.getElement();
var normalTbl = this.templNormal.getElement();
if(range.start > this.currRange.start
&& range.start < this.currRange.end) {
switchType = 1;
countToLoad = range.start - this.currRange.start;
if(countToLoad > 0) {
- startRowIndx = this._getRowIndex(frozenTbl.rows[0].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[0].id);
startIndex = this.currRange.end;
}
}
@@ -394,7 +393,7 @@
if(countToLoad > 0) {
startIndex = this.currRange.end;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
}
}
else {
@@ -403,7 +402,7 @@
if(countToLoad > 0) {
startIndex = range.start;
var restCount = this.rowsCount - countToLoad;
- startRowIndx = this._getRowIndex(frozenTbl.rows[restCount].id);
+ startRowIndx = this._getRowIndex(normalTbl.rows[restCount].id);
}
}
}
@@ -709,7 +708,7 @@
ensureVisible: function (index) {
if(index>=0 && index<this.grid.dataModel.getCount()) {
- var visibleRows = parseInt(this.contentBox.getHeight() / this.defaultRowHeight, 10) + 1;
+ var visibleRows = parseInt(this.contentBox.element.offsetHeight / this.defaultRowHeight, 10) + 1;
if(this.grid.dataModel.getCount() > visibleRows) {
var y = index*this.defaultRowHeight;
this.scrollBox.getElement().scrollTop = y;
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridFooter.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -102,12 +102,11 @@
this.helpObj = new ClientUI.common.box.Box(this.frozenContentBox.getElement(), null, true);
this.defaultWidth = this.grid.getHeader().defaultWidth;
+ this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
if(ClientUILib.isGecko) {
this.defaultHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
//this.defaultWidth -= this.getBorderWidth("lr") + this.getPadding("lr");
- } else {
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
- }
+ }
this.frozenSubstrate = new ClientUI.common.box.Box(this.grid.getElement().id + ":fs", this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "FRFrm";
@@ -116,11 +115,10 @@
},
updateSize: function() {
this.defaultWidth = this.grid.getHeader().defaultWidth;
+ this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
if(ClientUILib.isGecko) {
this.defaultHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
//this.defaultWidth -= this.getBorderWidth("lr") + this.getPadding("lr");
- } else {
- this.defaultHeight = this.headerRow.getElement().rows[0].cells[0].offsetHeight;
}
this.setHeight(this.defaultHeight);
this.setWidth(this.defaultWidth);
@@ -131,7 +129,7 @@
}
$super();
- var height = this.getHeight();
+ var height = this.element.offsetHeight;
var totalWidth = this.grid.getColumnsTotalWidth();
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -147,6 +145,7 @@
this.container.setWidth(viewWidth);
this.setWidth(viewWidth);
this.frozenSubstrate.setWidth(frozenContentWidth);
+ this.setFakeColumnWidth();
},
adjustScrollPosition: function(pos) {
this.contentBox.moveToX(this.grid.getColumnsFrozenWidth()-pos);
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/controls/grid/GridHeader.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -56,7 +56,6 @@
if(!template) {
return false;
}
-
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
if(childs[i].tagName && childs[i].tagName.toLowerCase() == "div") {
@@ -121,6 +120,7 @@
var ids = this.grid.options.ids;
var count = this.frozenCells.length;
for(i=0; i<count; i++) {
+ Utils.trace(i);
cell = this.frozenCells[i];
columns[j] = {
columnId: ids[i],
@@ -137,14 +137,18 @@
sortable: Validators.getBoolean(cell.getAttribute("sortable"), false),
sorted: Validators.getBoolean(cell.getAttribute("sorted"), "desc")
};
+ Utils.trace(i+"a");
if(columns[j].sortable)
Event.observe(cell, 'click', eventCellMouseDown);
- h = cell.offsetHeigh;
+ Utils.trace(i+"a1");
+ h = cell.offsetHeight;
+ Utils.trace(i+"a2");
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[j].width;
columns[j].object = new ClientUI.common.box.InlineBox(cell, null, true);
+ Utils.trace(i+"b");
var details = this._getCellElements(j);
// separator
columns[j].sep = new ClientUI.common.box.InlineBox(details[0], null, true);
@@ -161,6 +165,7 @@
//columns[j].sortDesc = new ClientUI.common.box.Box(details[1], null, true);
//columns[j].sortAsc = new ClientUI.common.box.Box(details[2], null, true);
j++;
+ Utils.trace(i+"c");
}
cols = this.headerRow.getElement().getElementsByTagName("col");
@@ -222,8 +227,8 @@
this.frozenSubstrate = new ClientUI.common.box.Box(this.gridId + ":hs", this.getElement());
this.frozenSubstrate.getElement().name = this.getElement().id + "HRFrm";
- this.frozenSubstrate.setHeight(this.headerRow.getHeight());
-
+ this.frozenSubstrate.setHeight(this.headerRow.element.offsetHeight);
+
return true;
},
_getCellElements: function(column) {
@@ -252,33 +257,33 @@
},
updateSize: function() {
var defaultWidth = 0, defaultHeight = 0;
- var i = 0, h, j=0;
+ var i = 0, h;
var columns = this._columns;
var cols = $A(this.headerFrozenRow.getElement().getElementsByTagName("col"));
- var cells = $A(this.headerFrozenRow.getElement().rows[0].cells);
- cells.each(function(cell) {
+ var count = this.frozenCells.length;
+ for(j=0; j<count; j++) {
+ cell = this.frozenCells[j];
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
- h = cell.offsetHeigh;
+ h = cell.offsetHeight;
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;j++;
- });
-
- j=0;
+ i++;
+ }
cols = $A(this.headerRow.getElement().getElementsByTagName("col"));
- cells = $A(this.headerRow.getElement().rows[0].cells);
- cells.each(function(cell) {
+ count = this.cells.length;
+ for(j=0; j<count; j++) {
+ cell = this.cells[j];
if(i<columns.length) {
columns[i].width = parseInt(cols[j].width);
- h = cell.offsetHeigh;
+ h = cell.offsetHeight;
if(h > defaultHeight) defaultHeight = h;
defaultWidth += columns[i].width;
}
- i++;j++;
- });
+ i++;
+ }
this.defaultHeight = defaultHeight;
this.defaultWidth = defaultWidth;
@@ -293,7 +298,7 @@
return;
}
$super();
- var height = this.getHeight();
+ var height = this.element.offsetHeight;
var totalWidth = this.grid.getColumnsTotalWidth();
var frozenContentWidth = this.grid.getColumnsFrozenWidth();
@@ -307,6 +312,7 @@
this.headerFrozenRow.setHeight(height);
this.frozenSubstrate.setWidth(frozenContentWidth);
this.updateHeaders();
+ this.setFakeColumnWidth();
},
getColumns: function() {
return this._columns;
@@ -372,7 +378,7 @@
}
this.dragColumnInfo.originalX = pos;
this.columnSplitter.show();
- this.columnSplitter.setHeight(this.defaultHeight + this.grid.getBody().contentBox.getHeight());
+ this.columnSplitter.setHeight(this.defaultHeight + this.grid.getBody().contentBox.element.offsetHeight);
this.columnSplitter.moveTo(pos, 0);
},
_hideSplitter: function() {
@@ -437,7 +443,7 @@
if (icon) {
var newPosX = div.clientWidth - icon.getWidth();
- var newPosY = (div.clientHeight - icon.getHeight())/2;
+ var newPosY = (div.clientHeight - icon.offsetHeight)/2;
newPosX = Math.floor(newPosX);
newPosY = Math.floor(newPosY);
@@ -485,4 +491,4 @@
sepStyleClass: "dr-sdt-hsep",
// internal variables
_columns: []
-});
\ No newline at end of file
+});
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/GridLayoutManager.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -30,7 +30,7 @@
var parentBox = this.getContainer();
if(parentBox==null) parentBox = this;
- var height = parentBox.getHeight();
+ var height = parentBox.element.offsetHeight;
var width = parentBox.getViewportWidth();
// NOTE: not implemented in this class
@@ -41,7 +41,7 @@
// first get size of header
if(this.panels[GridLayout_Enum.HEADER]) {
- headerHeight = this.panels[GridLayout_Enum.HEADER].getHeight();
+ headerHeight = this.panels[GridLayout_Enum.HEADER].element.offsetHeight;
this.panels[GridLayout_Enum.HEADER].moveTo(0, 0);
this.panels[GridLayout_Enum.HEADER].setWidth(width);
this.panels[GridLayout_Enum.HEADER].updateLayout();
@@ -58,7 +58,7 @@
}
if(this.panels[GridLayout_Enum.FOOTER]) {
- footerHeight = this.panels[GridLayout_Enum.FOOTER].getHeight();
+ footerHeight = this.panels[GridLayout_Enum.FOOTER].element.offsetHeight;
this.panels[GridLayout_Enum.FOOTER].moveTo(0, bodyBottom - footerHeight);
this.panels[GridLayout_Enum.FOOTER].setWidth(width);
this.panels[GridLayout_Enum.FOOTER].updateLayout();
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/LayoutManager.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -37,7 +37,7 @@
updateLayout: function($super) {
if(this.container) {
var w = this.container.getWidth();
- var h = this.container.getHeight();
+ var h = this.container.element.offsetHeight;
if(ClientUILib.isGecko) {
w -= this.container.getBorderWidth("lr") + this.container.getPadding("lr");
h -= this.container.getBorderWidth("tb") + this.container.getPadding("tb");
Modified: trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js
===================================================================
--- trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2008-01-11 17:37:38 UTC (rev 5313)
+++ trunk/ui/scrollableDataTable/src/main/javascript/ClientUI/layouts/VLayoutManager.js 2008-01-11 18:10:58 UTC (rev 5314)
@@ -50,7 +50,7 @@
var parentBox = this.getContainer();
if(!parentBox) parentBox = this;
- var height = parentBox.getHeight();
+ var height = parentBox.element.offsetHeight;
var width = parentBox.getViewportWidth();
if(ClientUILib.isGecko) {
width -= parentBox.getBorderWidth("lr") + parentBox.getPadding("lr");
@@ -64,13 +64,13 @@
// first get size of header
if(this.panels[GridLayout_Enum.HEADER]) {
- headerHeight = this.panels[GridLayout_Enum.HEADER].getHeight();
+ headerHeight = this.panels[GridLayout_Enum.HEADER].element.offsetHeight;
this.panels[GridLayout_Enum.HEADER].moveTo(0, 0);
this.panels[GridLayout_Enum.HEADER].setWidth(width);
this.panels[GridLayout_Enum.HEADER].updateLayout();
}
if(this.panels[GridLayout_Enum.FOOTER]) {
- footerHeight = this.panels[GridLayout_Enum.FOOTER].getHeight();
+ footerHeight = this.panels[GridLayout_Enum.FOOTER].element.offsetHeight;
this.panels[GridLayout_Enum.FOOTER].moveTo(0, height - footerHeight);
this.panels[GridLayout_Enum.FOOTER].setWidth(width);
this.panels[GridLayout_Enum.FOOTER].updateLayout();
17 years
JBoss Rich Faces SVN: r5313 - branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component.
by richfaces-svn-commits@lists.jboss.org
Author: konstantin.mishin
Date: 2008-01-11 12:37:38 -0500 (Fri, 11 Jan 2008)
New Revision: 5313
Modified:
branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
Log:
PS-140
Modified: branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java
===================================================================
--- branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-11 17:16:44 UTC (rev 5312)
+++ branches/3.1.x/ui/scrollableDataTable/src/main/java/org/richfaces/component/UIScrollableDataTable.java 2008-01-11 17:37:38 UTC (rev 5313)
@@ -93,12 +93,13 @@
int curentRow = getFirst();
+ int rows;
if(reqRowsCount == -1 ){
- reqRowsCount = getRows();
+ rows = getRows();
+ } else {
+ rows = reqRowsCount;
}
-
- int rows = reqRowsCount;
-
+
int rowsCount = getExtendedDataModel().getRowCount();
if(rows > 0){
17 years
JBoss Rich Faces SVN: r5312 - trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: sergeyhalipov
Date: 2008-01-11 12:16:44 -0500 (Fri, 11 Jan 2008)
New Revision: 5312
Modified:
trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
Log:
http://jira.jboss.com/jira/browse/RF-1844
Modified: trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js
===================================================================
--- trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-01-11 16:32:50 UTC (rev 5311)
+++ trunk/ui/suggestionbox/src/main/resources/org/richfaces/renderkit/html/scripts/suggestionbox.js 2008-01-11 17:16:44 UTC (rev 5312)
@@ -191,6 +191,7 @@
if (nothingLabel) {
Element.hide(nothingLabel);
Event.stopObserving(nothingLabel, "click", this.onNothingLabelClick);
+ Event.stopObserving(this.element, "blur", this.onNothingLabelClick);
this.hide();
}
},
@@ -638,6 +639,7 @@
if (this.entryCount < 1) {
Element.show(nothingLabel);
Event.observe(nothingLabel, "click", this.onNothingLabelClick);
+ Event.observe(this.element, "blur", this.onNothingLabelClick);
this.show();
}
}
17 years
JBoss Rich Faces SVN: r5311 - in branches/3.1.x/ui/calendar/src/main: resources/org/richfaces/renderkit/html/css and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: akushunin
Date: 2008-01-11 11:32:50 -0500 (Fri, 11 Jan 2008)
New Revision: 5311
Modified:
branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
RF-1461, RF-1725
Modified: branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-01-11 15:59:48 UTC (rev 5310)
+++ branches/3.1.x/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2008-01-11 16:32:50 UTC (rev 5311)
@@ -33,6 +33,8 @@
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
import java.util.Set;
import javax.faces.component.UIComponent;
@@ -73,8 +75,11 @@
protected static final String MARKUP_SUFFIX = "Markup";
- private final static Log log = LogFactory.getLog(CalendarRendererBase.class);
+ public static final String CALENDAR_BUNDLE = "org.richfaces.renderkit.calendar";
+ private final static Log log = LogFactory
+ .getLog(CalendarRendererBase.class);
+
/*
* (non-Javadoc)
*
@@ -518,4 +523,80 @@
result.addParameter(new Integer(0));
return result;
}
+
+ public void writeStringsFromBundle(ResourceBundle bundle1, ResourceBundle bundle2, String name,
+ ResponseWriter writer) throws IOException {
+
+ String label = null;
+ try {
+ if(null != bundle1){
+ label = bundle1.getString("RICH_CALENDAR_" + name.toUpperCase() + "_LABEL");
+ }
+
+ } catch (MissingResourceException e) {
+ // Current key wasn't found in application bundle, use CALENDAR_BUNDLE
+ try {
+
+ if(null != bundle2){
+ label = bundle2.getString("RICH_CALENDAR_" + name.toUpperCase() + "_LABEL");
+ }
+ } catch (MissingResourceException exc) {
+ // Current key wasn't found, use default, ignore this exception.
+ }
+ }
+ writeStringFoundInBundle(name, label, writer);
+
+ }
+
+ public void writeStringFoundInBundle(String name, String value, ResponseWriter writer) throws IOException {
+ if(null!=value){
+ if (!("close").equals(name.toLowerCase())) {
+ writer.writeText(name.toLowerCase() + ":'" + value + "', ",null);
+ } else {
+ writer.writeText("close:'" + value + "'", null);
+ }
+ }else{
+ if (!("close").equals(name.toLowerCase())) {
+ writer.writeText(name.toLowerCase() + ":'" + name + "', ",null);
+ } else {
+ writer.writeText("close:'x'", null);
+ }
+ }
+
+ }
+
+ public void writeLabels(FacesContext context, UICalendar calendar)
+ throws IOException {
+
+ ResourceBundle bundle1 = null;
+ ResourceBundle bundle2 = null;
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ String messageBundle = context.getApplication().getMessageBundle();
+ Object locale = calendar.getLocale();
+ if (null != messageBundle) {
+ bundle1 = ResourceBundle.getBundle(messageBundle, calendar.getAsLocale(locale), loader);
+ }
+ try {
+ bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, calendar.getAsLocale(locale), loader);
+
+ } catch (MissingResourceException e) {
+ //No external bundle was found, ignore this exception.
+ }
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.writeText(",\n labels:{", null);
+ if (null != bundle1 || null != bundle2) {
+ writeStringsFromBundle(bundle1, bundle2, "Apply", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Today", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Clean", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Cancel", writer);
+ writeStringsFromBundle(bundle1, bundle2, "OK", writer);
+ writeStringsFromBundle(bundle1, bundle2, "Close", writer);
+ }else{
+ // No bundles were found, use default labels.
+ writer.writeText("apply:'Apply', today:'Today', clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'", null);
+ }
+ writer.writeText("}", null);
+
+ }
}
Modified: branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2008-01-11 15:59:48 UTC (rev 5310)
+++ branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2008-01-11 16:32:50 UTC (rev 5311)
@@ -49,6 +49,7 @@
.rich-calendar-month{
vertical-align : middle;
text-align : center;
+ height : 22px;
}
.rich-calendar-days{
@@ -140,7 +141,7 @@
<u:selector name=".rich-calendar-cell">
<u:style name="border-bottom-color" skin="panelBorderColor"/>
<u:style name="border-right-color" skin="panelBorderColor"/>
- <u:style name="background-color" skin="generalBackgroundColor"/>
+ <u:style name="background-color" skin="tableBackgroundColor"/>
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
@@ -273,7 +274,7 @@
<u:style name="vertical-align" value="middle"/>
</u:selector>
- <u:selector name=".rich-calendar-time-shadow">
+ <u:selector name=".rich-calendar-editor-shadow">
<u:style name="background" skin="tableBackgroundColor"/>
<u:style name="opacity" value="0.5"/>
<u:style name="filter" value="alpha(opacity=50)"/>
@@ -286,10 +287,17 @@
<u:style name="position" value="relative"/>
</u:selector>
- <u:selector name=".rich-calendar-time-layout-container">
+ <u:selector name=".rich-calendar-date-layout">
+ <u:style name="background" skin="tableBackgroundColor"/>
+ <u:style name="border" value="1px solid"/>
+ <u:style name="border-color" skin="panelBorderColor"/>
+ <u:style name="position" value="relative"/>
</u:selector>
- <u:selector name=".rich-calendar-time-layout, .rich-calendar-time-layout input">
+ <u:selector name=".rich-calendar-editor-container">
+ </u:selector>
+
+ <u:selector name=".rich-calendar-time-layout, .rich-calendar-date-layout, .rich-calendar-time-layout input">
<u:style name="font-size" skin="generalSizeFont"/>
<u:style name="font-family" skin="generalFamilyFont"/>
</u:selector>
@@ -307,12 +315,32 @@
<u:style name="padding" value="0px 1px 7px 7px"/>
</u:selector>
+ <u:selector name=".rich-calendar-date-layout-cancel">
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="border-top" value="1px solid"/>
+ <u:style name="border-top-color" skin="panelBorderColor"/>
+ <u:style name="padding" value="5px 5px 5px 1px"/>
+ </u:selector>
+
+ <u:selector name=".rich-calendar-date-layout-ok">
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="border-top" value="1px solid"/>
+ <u:style name="border-top-color" skin="panelBorderColor"/>
+ <u:style name="padding" value="5px 1px 5px 5px"/>
+ </u:selector>
+
+ <u:selector name=".rich-calendar-date-layout-split">
+ <u:style name="border-right" value="1px solid"/>
+ <u:style name="border-right-color" skin="panelBorderColor"/>
+ </u:selector>
+
<u:selector name=".rich-calendar-time-btn">
<u:style name="width" value="45px"/>
<u:style name="border" value="1px solid"/>
<u:style name="border-color" skin="tableBackgroundColor"/>
<u:style name="border-right-color" skin="panelBorderColor"/>
<u:style name="border-bottom-color" skin="panelBorderColor"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
<u:style name="text-align" value="center"/>
<u:style name="padding" value="2px"/>
<u:style name="white-space" value="nowrap"/>
@@ -382,11 +410,53 @@
<u:style name="border-right-color" skin="subBorderColor" />
</u:selector>
- <u:selector name=".rich-calendar-time-layout-shadow">
+ <u:selector name=".rich-calendar-editor-layout-shadow">
<u:style name="background-color" skin="shadowBackgroundColor" />
<u:style name="opacity" value="0.3" />
<u:style name="filter" value="alpha(opacity=30)"/>
<u:style name="position" value="absolute"/>
</u:selector>
+
+ <u:selector name=".rich-calendar-editor-btn">
+ <u:style name="width" value="36px" />
+ <u:style name="padding" value="2px" />
+ <u:style name="margin" value="2px" />
+ <u:style name="text-align" value="center"/>
+ <u:style name="cursor" value="pointer"/>
+ </u:selector>
+ <u:selector name=".rich-calendar-editor-btn-over">
+ <u:style name="padding" value="1px" />
+ <u:style name="border" value="1px solid"/>
+ <u:style name="border-color" skin="panelBorderColor"/>
+ <u:style name="background" skin="calendarSpecBackgroundColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-calendar-editor-btn-selected">
+ <u:style name="background-color" skin="calendarCurrentBackgroundColor" />
+ <u:style name="padding" value="2px" />
+ <u:style name="border" value="0px" />
+ <u:style name="color" skin="calendarCurrentTextColor" />
+ <u:style name="font-weight" value="bold"/>
+ <u:style name="cursor" value="default"/>
+ </u:selector>
+
+ <u:selector name=".rich-calendar-editor-tool-over">
+ <u:style name="padding" value="1px" />
+ <u:style name="border" value="1px solid"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="border-color" skin="tableBackgroundColor"/>
+ <u:style name="border-right-color" skin="panelBorderColor"/>
+ <u:style name="border-bottom-color" skin="panelBorderColor"/>
+ </u:selector>
+
+ <u:selector name=".rich-calendar-editor-tool-press">
+ <u:style name="padding" value="1px" />
+ <u:style name="border" value="1px solid"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="border-color" skin="panelBorderColor"/>
+ <u:style name="border-right-color" skin="tableBackgroundColor"/>
+ <u:style name="border-bottom-color" skin="tableBackgroundColor"/>
+ </u:selector>
+
</f:template>
Modified: branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-01-11 15:59:48 UTC (rev 5310)
+++ branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-01-11 16:32:50 UTC (rev 5311)
@@ -366,7 +366,7 @@
if (ch=='d') {d=counter; counter++; return '(\\d{2})'};
}
);
-
+
var re = new RegExp(pattern,'i');
var match = dateString.match(re);
if (match!=null)
@@ -403,41 +403,42 @@
Richfaces.Calendar.formatDate = function(date, pattern, monthNames, monthNamesShort) {
if (!monthNames) monthNames = Richfaces.Calendar.getDefaultMonthNames();
if (!monthNamesShort) monthNamesShort = Richfaces.Calendar.getDefaultMonthNames(true);
- var mm; var dd; var hh;
- var result = pattern.replace(/(^|[^\\yMdHhm])(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
+ var mm; var dd; var hh; var min;
+ var result = pattern.replace(/(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g,
function($1,$2,$3) {
+ if ($2) return $2.charAt(1);
switch ($3) {
case 'y':
- case 'yy': return $2+date.getYear().toString().slice(-2);
- case 'M': return $2+(date.getMonth()+1);
- case 'MM': return $2+((mm = date.getMonth()+1)<10 ? '0'+mm : mm);
- case 'MMM': return $2+monthNamesShort[date.getMonth()];
- case 'd': return $2+date.getDate();
- case 'a' : return $2+(date.getHours()<12 ? 'AM' : 'PM');
- case 'HH' : return $2+((hh = date.getHours())<10 ? '0'+hh : hh);
- case 'H' : return $2+date.getHours();
- case 'hh' : return $2+((hh = date.getHours())==0 ? '12' : (hh<10 ? '0'+hh : (hh>12 ? hh-12 : hh)));
- case 'h' : return $2+((hh = date.getHours())==0 ? '12' : (hh>12 ? hh-12 : hh));
- case 'mm' : return $2+((min = date.getMinutes())<10 ? '0'+min : min);
+ case 'yy': return date.getYear().toString().slice(-2);
+ case 'M': return (date.getMonth()+1);
+ case 'MM': return ((mm = date.getMonth()+1)<10 ? '0'+mm : mm);
+ case 'MMM': return monthNamesShort[date.getMonth()];
+ case 'd': return date.getDate();
+ case 'a' : return (date.getHours()<12 ? 'AM' : 'PM');
+ case 'HH' : return ((hh = date.getHours())<10 ? '0'+hh : hh);
+ case 'H' : return date.getHours();
+ case 'hh' : return ((hh = date.getHours())==0 ? '12' : (hh<10 ? '0'+hh : (hh>12 ? hh-12 : hh)));
+ case 'h' : return ((hh = date.getHours())==0 ? '12' : (hh>12 ? hh-12 : hh));
+ case 'mm' : return ((min = date.getMinutes())<10 ? '0'+min : min);
}
// y+,M+,d+
var ch = $3.charAt(0);
- if (ch=='y') return $2+date.getFullYear();
- if (ch=='M') return $2+monthNames[date.getMonth()];
- if (ch=='d') return $2+((dd = date.getDate())<10 ? '0'+dd : dd);
+ if (ch=='y') return date.getFullYear();
+ if (ch=='M') return monthNames[date.getMonth()];
+ if (ch=='d') return ((dd = date.getDate())<10 ? '0'+dd : dd);
}
);
- return Richfaces.Calendar.unescape(result);
+ return result;
};
Richfaces.Calendar.escape = function (str)
{
- return str.replace(/([yMdaHhm])/g,"\\$1");
+ return str.replace(/([yMdaHhm\\])/g,"\\$1");
};
Richfaces.Calendar.unescape = function (str)
{
- return str.replace(/\\([yMdaHhm])/g,"$1");
+ return str.replace(/\\([yMdaHhm\\])/g,"$1");
};
@@ -548,6 +549,7 @@
// style - table style
// className - table class
+ //var _d = new Date();
this.id = id;
this.params = parameters;
@@ -605,12 +607,14 @@
this.POPUP_BUTTON_ID = this.id+'PopupButton';
this.INPUT_DATE_ID = this.id+'InputDate';
this.IFRAME_ID = this.id+'IFrame';
- this.TIME_EDITOR_ID = this.id+'TimeEditor';
- this.TIME_EDITOR_SHADOW_ID = this.id+'TimeEditorShadow';
+ this.EDITOR_ID = this.id+'Editor';
+ this.EDITOR_SHADOW_ID = this.id+'EditorShadow';
this.TIME_EDITOR_LAYOUT_ID = this.id+'TimeEditorLayout';
- this.TIME_EDITOR_LAYOUT_SHADOW_ID = this.id+'TimeEditorLayoutShadow';
+ this.DATE_EDITOR_LAYOUT_ID = this.id+'DateEditorLayout';
+ this.EDITOR_LAYOUT_SHADOW_ID = this.id+'EditorLayoutShadow';
+
//this.popupIntervalId=null;
this.firstDateIndex = 0;
@@ -646,6 +650,8 @@
var bottomStyleClass;
var htmlTextWeekDayBar='';
var context;
+ var tempStr = "$('"+this.id+"').component.";
+ var eventsStr = 'onclick="'+tempStr+'eventCellOnClick(event, this);" onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);" onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
if (this.params.showWeekDaysBar)
{
var htmlTextWeekDayBar = '<tr id="'+this.params.weekDayBarId+'">';
@@ -671,6 +677,7 @@
// week & weekNumber creation
var htmlTextWeek='';
var p=0;
+ this.dayCellClassName = [];
for (k=1;k<7;k++)
{
@@ -690,15 +697,16 @@
if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" rich-calendar-holly";
if (i==6) styleClass+=" rich-right-cell";
- htmlTextWeek+='<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'">'+(this.customDayListMarkup ? '<div class="rich-calendar-cell-div'+(this.params.dayCellClass ? ' '+this.params.dayCellClass : '')+'"></div>' : '')+'</td>';
+ this.dayCellClassName.push(styleClass);
+ htmlTextWeek+='<td class="'+styleClass+'" id="'+this.DATE_ELEMENT_ID+p+'"'+
+ eventsStr+
+ '>'+(this.customDayListMarkup ? '<div class="rich-calendar-cell-div'+(this.params.dayCellClass ? ' '+this.params.dayCellClass : '')+'"></div>' : '')+'</td>';
p++;
}
htmlTextWeek+='</tr>';
}
- var span=$(this.POPUP_ID);
-
- var obj = span.nextSibling;
+ var obj = $(this.POPUP_ID).nextSibling;
if (this.params.popup && Richfaces.browser.isIE6)
{
do {
@@ -727,8 +735,8 @@
obj.component = this;
obj.richfacesComponent="richfaces:calendar";
+ // memory leaks fix
obj = null;
- span = null;
if(this.params.submitFunction) this.submitFunction = this.params.submitFunction.bind(this);
this.prepareEvents();
@@ -744,8 +752,84 @@
}
}
+ //alert(new Date().getTime()-_d.getTime());
+
},
+
+ dateEditorSelectYear: function(value)
+ {
+ if (this.dateEditorYearID)
+ {
+ Element.removeClassName(this.dateEditorYearID, 'rich-calendar-editor-btn-selected');
+ }
+ this.dateEditorYear = this.dateEditorStartYear + value;
+ this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y'+value;
+ Element.addClassName(this.dateEditorYearID, 'rich-calendar-editor-btn-selected');
+ },
+
+ dateEditorSelectMonth: function(value)
+ {
+ this.dateEditorMonth = value;
+ Element.removeClassName(this.dateEditorMonthID, 'rich-calendar-editor-btn-selected');
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+value;
+ Element.addClassName(this.dateEditorMonthID, 'rich-calendar-editor-btn-selected');
+ },
+
+ scrollEditorYear: function(value)
+ {
+ var element = $(this.DATE_EDITOR_LAYOUT_ID+'TR');
+ if (this.dateEditorYearID)
+ {
+ Element.removeClassName(this.dateEditorYearID, 'rich-calendar-editor-btn-selected');
+ this.dateEditorYearID='';
+ }
+
+ if (!value)
+ {
+ // update month selection when open editor (value == 0)
+ if (this.dateEditorMonth != this.getCurrentMonth())
+ {
+ this.dateEditorMonth = this.getCurrentMonth();
+ Element.removeClassName(this.dateEditorMonthID, 'rich-calendar-editor-btn-selected');
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
+ Element.addClassName(this.dateEditorMonthID, 'rich-calendar-editor-btn-selected');
+ }
+ }
+
+ if (element)
+ {
+ var div;
+ var year = this.dateEditorStartYear = this.dateEditorStartYear+value*10;
+ for (var i=0;i<5;i++)
+ {
+ element = element.nextSibling;
+ div = element.firstChild.nextSibling.nextSibling;
+ div.firstChild.innerHTML=year;
+ if (year == this.dateEditorYear)
+ {
+ Element.addClassName(div.firstChild, 'rich-calendar-editor-btn-selected');
+ this.dateEditorYearID = div.firstChild.id;
+ }
+ div = div.nextSibling;
+ div.firstChild.innerHTML=year+5;
+ if (year+5 == this.dateEditorYear)
+ {
+ Element.addClassName(div.firstChild, 'rich-calendar-editor-btn-selected');
+ this.dateEditorYearID = div.firstChild.id;
+ }
+ year++;
+ }
+ }
+ },
+
+ updateDateEditor: function()
+ {
+ this.dateEditorYear = this.getCurrentYear();
+ this.dateEditorStartYear = this.getCurrentYear() - 4;
+ this.scrollEditorYear(0);
+ },
+
updateTimeEditor: function()
{
var th=$(this.id+'TimeHours');
@@ -764,18 +848,29 @@
tm.value = (m<10 ? '0'+m : m);
},
- createTimeEditor: function(element)
+
+ createEditor: function()
{
var element = $(this.id);
- var htmlBegin = '<div id="'+this.TIME_EDITOR_SHADOW_ID+'" class="rich-calendar-time-shadow" style="position:absolute; display:none;"></div><table border="0" cellpadding="0" cellspacing="0" id="'+this.TIME_EDITOR_ID+'" style="position:absolute; display:none;"><tbody><tr><td class="rich-calendar-time-layout-container" align="center"><div style="position:relative; width:100%">';
+ var htmlBegin = '<div id="'+this.EDITOR_SHADOW_ID+'" class="rich-calendar-editor-shadow" style="position:absolute; display:none;"></div><table border="0" cellpadding="0" cellspacing="0" id="'+this.EDITOR_ID+'" style="position:absolute; display:none;"><tbody><tr><td class="rich-calendar-editor-container" align="center"><div style="position:relative; width:100%">';
+ var htmlContent = '<div id="'+this.EDITOR_LAYOUT_SHADOW_ID+'" class="rich-calendar-editor-layout-shadow"></div>';
+
var htmlEnd = '</div></td></tr></tbody></table>';
- new Insertion.After(element, htmlBegin+this.evaluateMarkup(CalendarView.timeEditor, this.calendarContext)+htmlEnd);
- var te_shadow = $(this.TIME_EDITOR_SHADOW_ID);
- var te = $(this.TIME_EDITOR_ID);
+ new Insertion.After(element, htmlBegin+htmlContent+htmlEnd);
+ //+this.evaluateMarkup(CalendarView.timeEditor, this.calendarContext)+
+ var editor_shadow = $(this.EDITOR_SHADOW_ID);
+ var editor = $(this.EDITOR_ID);
var zindex = element.getStyle('z-index');
- te_shadow.style.zIndex = zindex;
- te.style.zIndex = parseInt(zindex,10)+1;
+ editor_shadow.style.zIndex = zindex;
+ editor.style.zIndex = parseInt(zindex,10)+1;
+ this.isEditorCreated = true;
+ },
+
+ createTimeEditorLayout: function()
+ {
+ Element.insert(this.EDITOR_LAYOUT_SHADOW_ID, {after:this.evaluateMarkup(this.calendarContext.timeEditorLayout, this.calendarContext)});
+
var th=$(this.id+'TimeHours');
var ts;
var tm=$(this.id+'TimeMinutes');
@@ -791,9 +886,65 @@
}
sbjQuery(tm).SpinButton({digits:2,min:0,max:59});
- this.isTimeEditorCreated = true;
+ this.isTimeEditorLayoutCreated = true;
},
+ createDECell: function(id, value, buttonType, param, className)
+ {
+ if (buttonType==0)
+ {
+ return '<div id="'+id+'" class="rich-calendar-editor-btn'+(className ? ' '+className : '')+
+ '" onmouseover="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onmouseout="this.className=\'rich-calendar-editor-btn\';" onmousedown="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-press\';" onmouseup="this.className=\'rich-calendar-editor-btn rich-calendar-editor-tool-over\';" onclick="$(\''+this.id+'\').component.scrollEditorYear('+param+');">'+value+'</div>';
+ }
+ else
+ {
+ var onclick = (buttonType==1 ? '$(\''+this.id+'\').component.dateEditorSelectMonth('+param+');':
+ '$(\''+this.id+'\').component.dateEditorSelectYear('+param+');' );
+ return '<div id="'+id+'" class="rich-calendar-editor-btn'+(className ? ' '+className : '')+
+ '" onmouseover="Element.addClassName(this, \'rich-calendar-editor-btn-over\');" onmouseout="Element.removeClassName(this,\'rich-calendar-editor-btn-over\');" onclick="'+onclick+'">'+value+'</div>';
+ }
+ },
+
+ createDateEditorLayout: function()
+ {
+ var htmlBegin = '<table id="'+this.DATE_EDITOR_LAYOUT_ID+'" class="rich-calendar-date-layout" border="0" cellpadding="0" cellspacing="0"><tbody><tr id="'+this.DATE_EDITOR_LAYOUT_ID+'TR">';
+ var htmlEnd = '</tr></tbody></table>';
+ var month = 0;
+ this.dateEditorYear = this.getCurrentYear();
+ var year = this.dateEditorStartYear = this.dateEditorYear-4;
+ var htmlContent = '<td>'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ +'<td>'+this.createDECell('','<', 0, -1)+'</td>'
+ +'<td>'+this.createDECell('','>', 0, 1)+'</td>';
+ month++;
+
+ for (var i=0;i<5;i++)
+ {
+ htmlContent+='</tr><tr><td>'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month, this.params.monthLabelsShort[month], 1, month)+'</td>'
+ +'<td class="rich-calendar-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6), this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
+ +'<td>'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+i, year, 2, i, (i==4 ? 'rich-calendar-editor-btn-selected' : ''))+'</td>'
+ +'<td>'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+(i+5), year+5, 2, i+5)+'</td>';
+ month++;
+ year++;
+ }
+ this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y4';
+ this.dateEditorMonth = this.getCurrentMonth();
+ this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
+
+ htmlContent+='</tr><tr><td colspan="2" class="rich-calendar-date-layout-ok">'+
+ '<div class="rich-calendar-time-btn" style="float:right;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(true);">'+this.params.labels.ok+'</div>'+
+ '</td><td colspan="2" class="rich-calendar-date-layout-cancel">'+
+ '<div class="rich-calendar-time-btn" style="float:left;" onmousedown="Element.addClassName(this, \'rich-calendar-time-btn-press\');" onmouseout="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onmouseup="Element.removeClassName(this, \'rich-calendar-time-btn-press\');" onclick="$(\''+this.id+'\').component.hideDateEditor(false);">'+this.params.labels.cancel+'</div>'+
+ '</td>';
+
+
+ Element.insert(this.EDITOR_LAYOUT_SHADOW_ID, {after:htmlBegin+htmlContent+htmlEnd});
+
+ Element.addClassName(this.dateEditorMonthID, 'rich-calendar-editor-btn-selected');
+
+ this.isDateEditorLayoutCreated = true;
+ },
+
createSpinnerTable: function(id) {
return '<table cellspacing="0" cellpadding="0" border="0"><tbody><tr>'+
'<td class="rich-calendar-spinner-input-container">'+
@@ -823,10 +974,11 @@
var dateTimePattern = this.params.datePattern;
var pattern = [];
- var re = /(^|[^\\yMdHhm])(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g;
+ var re = /(\\\\|\\[yMdaHhm])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2})/g;
var r;
while (r = re.exec(dateTimePattern))
- pattern.push({str:r[0],marker:r[2],pref:r[1],idx:r.index});
+ if (!r[1])
+ pattern.push({str:r[0],marker:r[2],idx:r.index});
var datePattern = "";
var timePattern = "";
@@ -873,20 +1025,21 @@
var calendar = this;
- this.timePatternHtml = timePattern.replace(/(^|[^\\Hhm])(H{1,2}|h{1,2}|m{2}|a)/g,
+ this.timePatternHtml = timePattern.replace(/(\\\\|\\[yMdaHhm])|(H{1,2}|h{1,2}|m{2}|a)/g,
function($1,$2,$3) {
+ if ($2) return $2.charAt(1);
switch ($3) {
- case 'a' : return ($2 ? '<td>'+$2+'</td>' : '')+'<td>'+calendar.createSpinnerTable(id+'TimeSign')+'</td>';//'<input class="rich-calendar-time-input" id="'+id+'TimeSign"/>';
+ case 'a' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeSign')+'</td><td>';
case 'H' :
case 'HH' :
case 'h' :
- case 'hh' : return ($2 ? '<td>'+$2+'</td>' : '')+'<td>'+calendar.createSpinnerTable(id+'TimeHours')+'</td>';//'<input class="rich-calendar-time-input" id="'+id+'TimeHours"/>';
- case 'mm' : return ($2 ? '<td>'+$2+'</td>' : '')+'<td>'+calendar.createSpinnerTable(id+'TimeMinutes')+'</td>';//'<input class="rich-calendar-time-input" id="'+id+'TimeMinutes"/>';
+ case 'hh' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeHours')+'</td><td>';
+ case 'mm' : return '</td><td>'+calendar.createSpinnerTable(id+'TimeMinutes')+'</td><td>';
}
}
);
- this.timePatternHtml = '<table><tbody><tr>'+this.timePatternHtml+'</tr></tbody></table>';
+ this.timePatternHtml = '<table border="0" cellpadding="0"><tbody><tr><td>'+this.timePatternHtml+'</td></tr></tbody></table>';
if (m && h)
{
@@ -902,12 +1055,8 @@
doCollapse: function() {
if (!this.params.popup || !this.isVisible) return;
- if (this.isTimeEditorCreated) this.hideTimeEditor();
+ if (this.isEditorVisible) this.hideEditor();
- /*this.stopTimer();
- this.stopPopupEvents($(this.id));
- this.stopPopupEvents($(this.POPUP_ID));*/
-
var element = $(this.id);
if (this.invokeEvent("collapse", element))
@@ -921,19 +1070,6 @@
Element.hide(element);
this.isVisible = false;
- /*if (this.floatedToBody && this.parent)
- {
- if (iframe)
- {
- document.body.removeChild(iframe);
- this.parent.appendChild(iframe);
- }
- document.body.removeChild(element);
- this.parent.appendChild(element);
- this.floatedToBody = false;
- this.parent = null;
- }*/
-
}
},
@@ -950,13 +1086,6 @@
var iframe=null;
if (Richfaces.browser.isIE6) iframe = $(this.IFRAME_ID);
- /*if (!this.floatedToBody) {
- this.parent = element.parentNode;
- if (iframe) document.body.insertBefore(this.parent.removeChild(iframe), null);
- document.body.insertBefore(this.parent.removeChild(element), null);
- this.floatedToBody = true;
- }*/
-
var base = $(this.POPUP_ID)
var baseInput = base.firstChild;
var baseButton = baseInput.nextSibling;
@@ -966,9 +1095,6 @@
this.selectDate(baseInput.value);
}
- /*this.setPopupEvents(e);
- this.setPopupEvents(base);*/
-
//rect calculation
var offsetBase = Position.cumulativeOffset(baseButton);
@@ -1082,52 +1208,9 @@
},
prepareEvents: function() {
- this.eventCellOnClick = this.eventCellOnClick.bindAsEventListener(this);
- this.eventCellOnMouseOver = this.eventCellOnMouseOver.bindAsEventListener(this);
- this.eventCellOnMouseOut = this.eventCellOnMouseOut.bindAsEventListener(this);
this.eventOnCollapse = this.eventOnCollapse.bindAsEventListener(this);
- //this.eventOnMouseOver = this.eventOnMouseOver.bindAsEventListener(this);
- //this.eventOnMouseOut = this.eventOnMouseOut.bindAsEventListener(this);
},
-/* setPopupEvents: function(obj) {
- Event.observe(obj, "mouseover", this.eventOnMouseOver, false);
- Event.observe(obj, "mouseout", this.eventOnMouseOut, false);
- },
-
- stopPopupEvents: function(obj) {
- Event.stopObserving(obj, "mouseover", this.eventOnMouseOver, false);
- Event.stopObserving(obj, "mouseout", this.eventOnMouseOut, false);
- },
- *
- stopTimer: function()
- {
- if (this.popupIntervalId!=null)
- {
- clearTimeout(this.popupIntervalId);
- this.popupIntervalId=null;
- }
- },
-
- eventOnMouseOver: function(e) {
- this.stopTimer();
- },
-
- eventOnMouseOut: function(e) {
- if (this.popupIntervalId==null) this.popupIntervalId = setTimeout('$("'+this.id+'").component.doCollapse()',400);
- },*/
-
- setCellEvents: function(obj) {
- Event.observe(obj, "click", this.eventCellOnClick, false);
- Event.observe(obj, "mouseover", this.eventCellOnMouseOver, false);
- Event.observe(obj, "mouseout", this.eventCellOnMouseOut, false);
- },
- stopCellEvents: function(obj) {
- Event.stopObserving(obj, "click", this.eventCellOnClick, false);
- Event.stopObserving(obj, "mouseover", this.eventCellOnMouseOver, false);
- Event.stopObserving(obj, "mouseout", this.eventCellOnMouseOut, false);
- },
-
invokeEvent: function(eventName, element, event, date) {
var eventFunction = this.params['on'+eventName];
var result;
@@ -1166,59 +1249,44 @@
return result;
},
- eventCellOnClick: function (e) {
- var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
- if (obj)
+ eventCellOnClick: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (daydata.enabled && daydata._month==0)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (daydata.enabled && daydata._month==0)
+ var date=new Date(this.currentDate);
+ date.setDate(daydata.day);
+
+ if (this.selectDate(date,true) && !this.showApplyButton)
{
- var date=new Date(this.currentDate);
- date.setDate(daydata.day);
+ this.doCollapse();
+ }
- if (this.selectDate(date,true) && !this.showApplyButton)
+ } else {
+ if (this.params.boundaryDatesMode == "scroll")
+ if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
+ else if (this.params.boundaryDatesMode == "select")
+ {
+ if (this.selectDate(daydata.date) && !this.showApplyButton)
{
- this.doCollapse();
+ this.doCollapse();
}
-
- } else {
- if (this.params.boundaryDatesMode == "scroll")
- if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
- else if (this.params.boundaryDatesMode == "select")
- {
- //var date = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()+daydata._month, daydata.day);
- if (this.selectDate(daydata.date) && !this.showApplyButton)
- {
- this.doCollapse();
- }
- }
}
}
},
- eventCellOnMouseOver: function (e) {
- var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
- if (obj)
+ eventCellOnMouseOver: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (this.invokeEvent("datemouseover", obj, e, daydata.date) && daydata.enabled)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- //var date = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()+daydata._month, daydata.day);
- if (this.invokeEvent("datemouseover", obj, e, daydata.date) && daydata.enabled)
- {
- if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) Element.addClassName(obj,'rich-calendar-hover');
- }
+ if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) Element.addClassName(obj,'rich-calendar-hover');
}
},
- eventCellOnMouseOut: function (e) {
- var obj = Event.findElementByAttr(e, "TD", "id", this.DATE_ELEMENT_ID, true);
- if (obj)
+ eventCellOnMouseOut: function (e, obj) {
+ var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
+ if (this.invokeEvent("datemouseout", obj, e, daydata.date) && daydata.enabled)
{
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- //var date = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()+daydata._month, daydata.day);
- if (this.invokeEvent("datemouseout", obj, e, daydata.date) && daydata.enabled)
- {
- if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) Element.removeClassName(obj,'rich-calendar-hover');
- }
+ if (daydata._month==0 && obj.id!=this.selectedDateCellId && obj.id!=this.todayCellId) Element.removeClassName(obj,'rich-calendar-hover');
}
},
@@ -1235,7 +1303,7 @@
// styleClass
// }
- if (!$(this.id).component) return;
+ //if (!$(this.id).component) return;
if (daysData) {
this.daysData = this.indexData(daysData, isAjaxMode);
@@ -1316,7 +1384,7 @@
},
render:function() {
-
+ //var _d=new Date();
this.todayDate = new Date();
var currentYear = this.getCurrentYear();
@@ -1406,8 +1474,8 @@
var boundaryDatesModeFlag = (this.params.boundaryDatesMode == "scroll" || this.params.boundaryDatesMode == "select");
- this.todayCellId = this.clearEffect(this.todayCellId, this.highlightEffect, "rich-calendar-today");
- this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, this.highlightEffect2, "rich-calendar-select", "rich-calendar-btn");
+ this.todayCellId = this.clearEffect(this.todayCellId, this.highlightEffect);
+ this.selectedDateCellId = this.clearEffect(this.selectedDateCellId, this.highlightEffect2);
//var _d=new Date();
var obj = $(this.params.weekNumberBarId+"1");
@@ -1440,9 +1508,6 @@
while (element)
{
- // TODO fix start/stop event's calls
- this.stopCellEvents(element);
-
dataobj.elementId=element.id;
dataobj.date=new Date(currentYear, currentMonth+dataobj._month, dataobj.day);
dataobj.weekNumber = weeknumber;
@@ -1457,7 +1522,7 @@
else
{
var styleclass = this.params.dayStyleClass(dataobj);
- dataobj.customStyleClass = dataobj.styleClass
+ dataobj.customStyleClass = dataobj.styleClass;
if (styleclass) dataobj.customStyleClass += " " + styleclass;
}
@@ -1466,58 +1531,48 @@
if (weekdaycounter==6) weekdaycounter=0; else weekdaycounter++;
+ var classNames = this.dayCellClassName[p];
+
// class styles
- e = Element.classNames(element);
- // remove custom style class
- if (element.rich && element.rich.customStyleClass)
- {
- element.rich.customStyleClass.split(' ').each(function(name){e.remove(name);});
- element.rich.customStyleClass = null;
- }
-
if (dataobj._month!=0)
{
- e.add('rich-calendar-boundary-dates');
+ classNames+=' rich-calendar-boundary-dates';
if (boundaryDatesModeFlag)
- e.add('rich-calendar-btn');
- else
- e.remove('rich-calendar-btn');}
+ {
+ classNames+=' rich-calendar-btn';
+ }
+ }
else
{
- e.remove('rich-calendar-boundary-dates');
- if (dataobj.enabled) e.add('rich-calendar-btn'); else e.remove('rich-calendar-btn');
+ if (todayflag && dataobj.day==todaydate)
+ {
+ this.todayCellId = element.id;
+ this.todayCellColor = this.getCellBackgroundColor(element);
+ classNames+=" rich-calendar-today";
+ }
+
+ if (selectedflag && dataobj.day==selecteddate)
+ {
+ this.selectedDateCellId = element.id;
+ this.selectedDateCellColor = this.getCellBackgroundColor(element);
+ classNames+=" rich-calendar-select";
+ }
+ else if (dataobj.enabled) classNames+=' rich-calendar-btn';
// add custom style class
if (dataobj.customStyleClass)
{
- e.add(dataobj.customStyleClass);
- element.rich = {customStyleClass: dataobj.customStyleClass};
+ classNames+=' '+dataobj.customStyleClass;
}
}
+ element.className = classNames;
- // TODO make some optimization with rich-calendar-today class
- if (todayflag && dataobj._month==0 && dataobj.day==todaydate)
- {
- this.todayCellId = element.id;
- this.todayCellColor = this.getCellBackgroundColor(element);
- e.add("rich-calendar-today");
- }
-
- if (selectedflag && dataobj._month==0 && dataobj.day==selecteddate)
- {
- this.selectedDateCellId = element.id;
- this.selectedDateCellColor = this.getCellBackgroundColor(element);
- e.remove("rich-calendar-btn");
- e.add("rich-calendar-select");
- }
-
- this.setCellEvents(element);
p++;
dataobj = this.days[p];
element=element.nextSibling;
}
- obj = obj.nextSibling;
+ obj = obj.nextSibling;
}
//alert(new Date().getTime()-_d.getTime());
@@ -1532,7 +1587,6 @@
element.style.height = "0px";
}
}*/
-
},
renderHF: function()
@@ -1579,22 +1633,34 @@
},
nextMonth: function() {
- this.changeCurrentDate(0,1);
+ this.changeCurrentDateOffset(0,1);
},
prevMonth: function() {
- this.changeCurrentDate(0,-1);
+ this.changeCurrentDateOffset(0,-1);
},
nextYear: function() {
- this.changeCurrentDate(1,0);
+ this.changeCurrentDateOffset(1,0);
},
prevYear: function() {
- this.changeCurrentDate(-1,0);
+ this.changeCurrentDateOffset(-1,0);
},
- changeCurrentDate: function(yearOffset, monthOffset) {
+ changeCurrentDate: function(year, month) {
+ if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
+ {
+ var date = new Date(year, month,1);
+ if (this.invokeEvent("currentdateselect", $(this.id), null, date))
+ {
+ this.currentDate = date;
+ this.onUpdate();
+ }
+ }
+ },
+
+ changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset, this.currentDate.getMonth()+monthOffset,1);
if (this.invokeEvent("currentdateselect", $(this.id), null, date))
{
@@ -1602,7 +1668,7 @@
this.onUpdate();
}
},
-
+
today: function(noUpdate, noHighlight) {
var now = new Date();
@@ -1844,35 +1910,51 @@
this.doCollapse();
},
+ setEditorPosition: function (element, editor, shadow)
+ {
+ element;
+
+ var dim = Richfaces.Calendar.getOffsetDimensions(element);
+ editor.style.width = shadow.style.width = dim.width + 'px';
+ editor.style.height = shadow.style.height = dim.height + 'px';
+
+ Richfaces.Calendar.clonePosition([editor,shadow], element);
+ },
+
showTimeEditor: function()
{
if (this.timeType==0) return;
- if (!this.isTimeEditorCreated) this.createTimeEditor();
+ if (!this.isEditorCreated) this.createEditor();
+ if (!this.isTimeEditorLayoutCreated) this.createTimeEditorLayout();
- var element = $(this.id);
+ $(this.TIME_EDITOR_LAYOUT_ID).show();
- var te = $(this.TIME_EDITOR_ID);
- var te_shadow = $(this.TIME_EDITOR_SHADOW_ID);
+ var editor = $(this.EDITOR_ID);
+ var editor_shadow = $(this.EDITOR_SHADOW_ID);
- var dim = Richfaces.Calendar.getOffsetDimensions(element);
- te.style.width = te_shadow.style.width = dim.width + 'px';
- te.style.height = te_shadow.style.height = dim.height + 'px';
+ this.setEditorPosition($(this.id), editor, editor_shadow);
- Richfaces.Calendar.clonePosition([te,te_shadow], element);
-
this.updateTimeEditor();
- te_shadow.show();
- te.show();
+ editor_shadow.show();
+ editor.show();
- Element.clonePosition(this.TIME_EDITOR_LAYOUT_SHADOW_ID, this.TIME_EDITOR_LAYOUT_ID, {offsetLeft: 3, offsetTop: 3});
+ Element.clonePosition(this.EDITOR_LAYOUT_SHADOW_ID, this.TIME_EDITOR_LAYOUT_ID, {offsetLeft: 3, offsetTop: 3});
+ this.isEditorVisible = true;
},
+
+ hideEditor: function()
+ {
+ if (this.isTimeEditorLayoutCreated) $(this.TIME_EDITOR_LAYOUT_ID).hide();
+ if (this.isDateEditorLayoutCreated) $(this.DATE_EDITOR_LAYOUT_ID).hide();
+ $(this.EDITOR_ID).hide();
+ $(this.EDITOR_SHADOW_ID).hide();
+ this.isEditorVisible = false;
+ },
hideTimeEditor: function(updateTime)
{
- $(this.TIME_EDITOR_ID).hide();
- $(this.TIME_EDITOR_SHADOW_ID).hide();
-
+ this.hideEditor();
if (updateTime && this.selectedDate)
{
var m = parseInt($(this.id+'TimeMinutes').value,10);
@@ -1894,6 +1976,36 @@
}
if (this.params.popup && !this.showApplyButton && updateTime) this.close(true);
+ },
+
+ showDateEditor: function()
+ {
+ if (!this.isEditorCreated) this.createEditor();
+ if (!this.isDateEditorLayoutCreated) this.createDateEditorLayout();
+ else this.updateDateEditor();
+
+ $(this.DATE_EDITOR_LAYOUT_ID).show();
+
+ var editor = $(this.EDITOR_ID);
+ var editor_shadow = $(this.EDITOR_SHADOW_ID);
+
+ this.setEditorPosition($(this.id), editor, editor_shadow);
+
+ editor_shadow.show();
+ editor.show();
+
+ Element.clonePosition(this.EDITOR_LAYOUT_SHADOW_ID, this.DATE_EDITOR_LAYOUT_ID, {offsetLeft: 3, offsetTop: 3});
+
+ this.isEditorVisible = true;
+ },
+
+ hideDateEditor: function(updateCurrentDate)
+ {
+ this.hideEditor();
+ if (updateCurrentDate)
+ {
+ this.changeCurrentDate(this.dateEditorYear, this.dateEditorMonth);
+ }
}
});
@@ -1937,13 +2049,13 @@
CalendarView.previousYearControl = CalendarView.getControl("<<", CalendarView.toolButtonAttributes, "prevYear");
CalendarView.nextMonthControl = CalendarView.getControl(">", CalendarView.toolButtonAttributes, "nextMonth");
CalendarView.previousMonthControl = CalendarView.getControl("<", CalendarView.toolButtonAttributes, "prevMonth");
-CalendarView.currentMonthControl = function (context) { return Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort);};
-CalendarView.todayControl = function (context) { return (context.calendar.todayControlMode!='hidden' ? CalendarView.getControl("Today", CalendarView.toolButtonAttributes, "today") : "");};
+CalendarView.currentMonthControl = function (context) { return CalendarView.getControl(Richfaces.Calendar.formatDate(context.calendar.getCurrentDate(), "MMMM, yyyy", context.monthLabels, context.monthLabelsShort), CalendarView.toolButtonAttributes, "showDateEditor");};
+CalendarView.todayControl = function (context) { return (context.calendar.todayControlMode!='hidden' ? CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes, "today") : "");};
CalendarView.selectedDateControl = function (context) { return CalendarView.getSelectedDateControl(context.calendar);};
CalendarView.timeControl = function (context) { return CalendarView.getTimeControl(context.calendar);};
-CalendarView.closeControl = function (context) { return (context.calendar.params.popup ? CalendarView.getControl("x", CalendarView.toolButtonAttributes, "close", "false") : "");};
-CalendarView.applyControl = function (context) { return (context.calendar.showApplyButton ? CalendarView.getControl("Apply", CalendarView.toolButtonAttributes, "close", "true") : "");};
-CalendarView.cleanControl = function (context) { return (context.calendar.selectedDate ? CalendarView.getControl("Clean", CalendarView.toolButtonAttributes, "resetSelectedDate") : "");};
+CalendarView.closeControl = function (context) { return (context.calendar.params.popup ? CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes, "close", "false") : "");};
+CalendarView.applyControl = function (context) { return (context.calendar.showApplyButton ? CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes, "close", "true") : "");};
+CalendarView.cleanControl = function (context) { return (context.calendar.selectedDate ? CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes, "resetSelectedDate") : "");};
CalendarView.timeEditorFields = function (context) { return context.calendar.timePatternHtml;};
CalendarView.header = [
@@ -1964,7 +2076,7 @@
new E('td',{'class': 'rich-calendar-month'},
[
new ET(function (context) { return Richfaces.evalMacro("currentMonthControl", context)})
- ]),
+ ]),
new E('td',{'class': 'rich-calendar-tool'},
[
new ET(function (context) { return Richfaces.evalMacro("nextMonthControl", context)})
@@ -2015,10 +2127,8 @@
]
)];
-CalendarView.timeEditor = [
+CalendarView.timeEditorLayout = [
- new E('div',{'id': function(context){return context.calendar.TIME_EDITOR_LAYOUT_SHADOW_ID}, 'class': 'rich-calendar-time-layout-shadow'},null),
-
new E('table',{'id': function(context){return context.calendar.TIME_EDITOR_LAYOUT_ID}, 'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'class': 'rich-calendar-time-layout'},
[
new E('tbody',{},
@@ -2036,7 +2146,7 @@
[
new E('div',{'class': 'rich-calendar-time-btn', 'style': 'float:right;', 'onmousedown': "Element.addClassName(this, 'rich-calendar-time-btn-press');", 'onmouseout': "Element.removeClassName(this, 'rich-calendar-time-btn-press');", 'onmouseup': "Element.removeClassName(this, 'rich-calendar-time-btn-press');", 'onclick': function(context){return "$('"+context.calendar.id+"').component.hideTimeEditor(true)";}},
[
- new T('Ok')
+ new ET(function (context) { return context.controlLabels.ok; })
])
])
,
@@ -2044,7 +2154,7 @@
[
new E('div',{'class': 'rich-calendar-time-btn', 'style': 'float:left;', 'onmousedown': "Element.addClassName(this, 'rich-calendar-time-btn-press');", 'onmouseout': "Element.removeClassName(this, 'rich-calendar-time-btn-press');", 'onmouseup': "Element.removeClassName(this, 'rich-calendar-time-btn-press');", 'onclick': function(context){return "$('"+context.calendar.id+"').component.hideTimeEditor(false)";}},
[
- new T('Cancel')
+ new ET(function (context) { return context.controlLabels.cancel; })
])
])
])
@@ -2064,6 +2174,7 @@
this.monthLabelsShort=calendar.params.monthLabelsShort;
this.weekDayLabels=calendar.params.weekDayLabels;
this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
+ this.controlLabels=calendar.params.labels;
},
nextYearControl: CalendarView.nextYearControl,
@@ -2077,5 +2188,6 @@
todayControl: CalendarView.todayControl,
closeControl: CalendarView.closeControl,
applyControl: CalendarView.applyControl,
- timeEditorFields: CalendarView.timeEditorFields
+ timeEditorFields: CalendarView.timeEditorFields,
+ timeEditorLayout: CalendarView.timeEditorLayout
});
\ No newline at end of file
Modified: branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-01-11 15:59:48 UTC (rev 5310)
+++ branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-01-11 16:32:50 UTC (rev 5311)
@@ -12,7 +12,7 @@
<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/jquery.js,/org/richfaces/renderkit/html/scripts/JQuerySpinBtn.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
<h:styles>/org/richfaces/renderkit/html/css/calendar.xcss</h:styles>
-
+
<f:call name="addPopupToAjaxRendered" />
<span id="#{clientId}Popup"
@@ -50,7 +50,7 @@
<f:resource
name="org.richfaces.renderkit.html.iconimages.DisabledCalendarIcon"
var="disabledIcon" />
-
+
<input id="#{clientId}InputDate"
name="#{clientId}InputDate"
value="#{this:getInputValue(context,component)}" type="#{type}"
@@ -188,16 +188,15 @@
showWeeksBar:#{component.attributes['showWeeksBar']},
showWeekDaysBar:#{component.attributes['showWeekDaysBar']},
showApplyButton:#{component.attributes['showApplyButton']}
+
+ <f:call name="writeLabels" />
-
-
<f:call name="writeClass"/>
<f:call name="writeDayCellClass"/>
<f:call name="writeDayStyleClass"/>
<f:call name="writeIsDayEnabled"/>
<f:call name="writeSymbols" />
-
-
+
<f:call name="writeEventHandlerFunction"><f:parameter value="ondateselected" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="ondateselect" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="ondatemouseover" /></f:call>
17 years
JBoss Rich Faces SVN: r5310 - trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-11 10:59:48 -0500 (Fri, 11 Jan 2008)
New Revision: 5310
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
Log:
fix layout
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-11 15:46:22 UTC (rev 5309)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-11 15:59:48 UTC (rev 5310)
@@ -52,13 +52,17 @@
.rich-combobox-input-default {
position : absolute;
- top : 0px; left : 0px;
+ top : 0px;
+ left : 0px;
padding-right :20px;
padding-left :3px;
margin : 0px;
border : 1px solid;
background-position:left top;
- background-repeat:repeat-x;
+ background-repeat:repeat-x;
+} /*panelBorderColor*/
+
+.cb_strut{ position : relative; visibility : hidden; margin : 0px; padding : 2px;
}
/*.rich-combobox-list {
@@ -69,7 +73,7 @@
.rich-combobox-list-position {
position : absolute;
- top:-5px;
+ top:-1px;
left:0px;
}
17 years
JBoss Rich Faces SVN: r5309 - in trunk/sandbox/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-11 10:46:22 -0500 (Fri, 11 Jan 2008)
New Revision: 5309
Modified:
trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
input width was added
Modified: trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml
===================================================================
--- trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml 2008-01-11 15:45:30 UTC (rev 5308)
+++ trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml 2008-01-11 15:46:22 UTC (rev 5309)
@@ -67,6 +67,12 @@
<description></description>
</property>
+ <property>
+ <name>width</name>
+ <classname>java.lang.String</classname>
+ <description></description>
+ <defaultvalue><![CDATA["150"]]></defaultvalue>
+ </property>
<property>
<name>listWidth</name>
<classname>java.lang.String</classname>
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-11 15:45:30 UTC (rev 5308)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-11 15:46:22 UTC (rev 5309)
@@ -44,6 +44,12 @@
}
variables.setVariable("listWidth", listWidth);
+ String width = (String) component.getAttributes().get("width");
+ if (width != null) {
+ width = HtmlUtil.qualifySize(width);
+ }
+ variables.setVariable("width", width);
+
String inputSize = (String) component.getAttributes().get("inputSize");
variables.setVariable("inputSize", inputSize);
@@ -158,29 +164,25 @@
</jsp:scriptlet>
<div id="#{clientId}" class="rich-combobox-font rich-combobox-shell #{styleClass}" style="width:#{listWidth}; #{style}">
- <div class="cb_width_field rich-combobox-font rich-combobox-shell">
+ <div class="rich-combobox-font rich-combobox-shell" style="width:#{width}">
<input id="comboboxField#{clientId}"
name="comboboxField#{clientId}"
disabled="#{disabled}"
- class="cb_width_field rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}" type="text"
+ class="rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}" type="text"
value="#{value}"
size="#{inputSize}"
autocomplete="off"
- style="width:#{listWidth}; #{inputStyle}"
+ style="width:#{width}; #{inputStyle}"
x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled"
- >
- </input>
- <input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button">
- </input>
+ />
+ <input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button"/>
<input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}"
class="rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button #{buttonDisabledClass}"
onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-button-pressed rich-combobox-font rich-combobox-button-icon';"
onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-font rich-combobox-button-icon'"
onmouseout="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button'"
- onmouseover="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'">
- </input>
- <input type="text" class="cb_width_field rich-combobox-strut rich-combobox-font">
- </input>
+ onmouseover="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'"/>
+ <input type="text" class="rich-combobox-strut rich-combobox-font" style="width:#{width}"/>
</div>
<div id="listParent#{clientId}" class="rich-combobox-list-cord #{listClass}" style="display:none; #{listStyle};">
17 years
JBoss Rich Faces SVN: r5308 - trunk/docs/userguide/en/src/main/resources/images.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-11 10:45:30 -0500 (Fri, 11 Jan 2008)
New Revision: 5308
Added:
trunk/docs/userguide/en/src/main/resources/images/comboBox.png
Log:
http://jira.jboss.com/jira/browse/RF-1702 - add initial screenshot
Added: trunk/docs/userguide/en/src/main/resources/images/comboBox.png
===================================================================
(Binary files differ)
Property changes on: trunk/docs/userguide/en/src/main/resources/images/comboBox.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
17 years
JBoss Rich Faces SVN: r5307 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-11 10:45:12 -0500 (Fri, 11 Jan 2008)
New Revision: 5307
Added:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
Log:
http://jira.jboss.com/jira/browse/RF-1702 - add Component identification parameters, Creating the Component with a Page Tag, Creating the Component Dynamically Using Java
Added: trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.xml 2008-01-11 15:45:12 UTC (rev 5307)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>rich:comboBox</keyword>
+ <keyword>comboBox</keyword>
+ </keywordset>
+ </sectioninfo>
+ <table>
+ <title>Component identification parameters</title>
+
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Name</entry>
+
+ <entry>Value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>component-type</entry>
+ <entry>org.richfaces.ComboBox</entry>
+ </row>
+ <row>
+ <entry>component-class</entry>
+ <entry>org.richfaces.component.html.HtmlComboBox</entry>
+ </row>
+ <row>
+ <entry>component-family</entry>
+ <entry>org.richfaces.ComboBox</entry>
+ </row>
+ <row>
+ <entry>renderer-type</entry>
+ <entry>org.richfaces.renderkit.ComboBoxRenderer</entry>
+ </row>
+ <!--row>
+ <entry>tag-class</entry>
+ <entry></entry>
+ </row-->
+ </tbody>
+ </tgroup>
+ </table>
+ <section>
+ <title>Creating the Component with a Page Tag</title>
+ <para>Here is a simple example as it could be used on a page: </para>
+
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="XML"><![CDATA[...
+<rich:comboBox value="#{bean.state}" valueChangeListener="#{bean.selectionChanged}" suggestionValues="#{bean.suggestions}">
+ <f:selectItems value="#{bean.selectItems}"/>
+<rich:comboBox>
+...]]></programlisting>
+ </section>
+ <section>
+ <title>Creating the Component Dynamically Using Java</title>
+ <para>
+ <emphasis role="bold">Example:</emphasis>
+ </para>
+ <programlisting role="JAVA"><![CDATA[import org.richfaces.component.html.HtmlComboBox;
+...
+HtmlComboBox myComboBox = new HtmlComboBox();
+...]]></programlisting>
+ </section>
+</section>
\ No newline at end of file
17 years
JBoss Rich Faces SVN: r5306 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: artdaw
Date: 2008-01-11 10:44:59 -0500 (Fri, 11 Jan 2008)
New Revision: 5306
Added:
trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml
Log:
http://jira.jboss.com/jira/browse/RF-1702 - add Description
Added: trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml (rev 0)
+++ trunk/docs/userguide/en/src/main/docbook/included/comboBox.desc.xml 2008-01-11 15:44:59 UTC (rev 5306)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<section>
+ <sectioninfo>
+ <keywordset>
+ <keyword>comboBox</keyword>
+ </keywordset>
+ </sectioninfo>
+ <section>
+ <title>Description</title>
+ <para>The <emphasis role="bold">
+ <property><rich:comboBox></property>
+ </emphasis> is a component, that provides editable combo box element on the page.</para>
+ <figure>
+ <title><rich:comboBox> component</title>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="images/comboBox.png"/>
+ </imageobject>
+ </mediaobject>
+ </figure>
+
+ </section>
+ <section>
+ <title>Key Features</title>
+ <itemizedlist>
+ <listitem>Highly customizable look and feel</listitem>
+ <listitem>Plain skin support</listitem>
+ <listitem>Browser like selection</listitem>
+ <listitem>Smart user-defined positioning</listitem>
+ <listitem>Multicolumn suggestion popup list</listitem>
+ <listitem>Possible to set the popup appearance delay through <emphasis><property>"showDelay"</property></emphasis>
+ or <emphasis><property>"minChars"</property></emphasis> attributes
+ </listitem>
+
+ </itemizedlist>
+ </section>
+</section>
17 years
JBoss Rich Faces SVN: r5305 - in trunk/sandbox/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-01-11 10:35:43 -0500 (Fri, 11 Jan 2008)
New Revision: 5305
Modified:
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
designer's mockup was implemented
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-11 15:34:00 UTC (rev 5304)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/css/combobox.xcss 2008-01-11 15:35:43 UTC (rev 5305)
@@ -6,6 +6,10 @@
<f:verbatim>
<![CDATA[
+cb_width_field.{
+ width: 400px;
+}
+
.rich-combobox-button-pressed {
}
@@ -19,6 +23,7 @@
}
.rich-combobox-font {
+ font-size : 11px/*generalSizeFont*/; font-family : arial/*generalFamilyFont*/; color : #000000/*generalTextColor*/
}
.rich-combobox-font-disabled {
@@ -56,18 +61,22 @@
background-repeat:repeat-x;
}
-.rich-combobox-list {
+/*.rich-combobox-list {
z-index: 1000;
overflow: auto;
white-space:nowrap;
-}
+}*/
.rich-combobox-list-position {
- /*position : absolute;*/
+ position : absolute;
+ top:-5px;
+ left:0px;
}
.rich-combobox-list-decoration {
- border : 1px solid; padding : 0px;
+ border : 1px solid #BED6F8 /*panelBorderColor*/;
+ padding : 0px;
+ background : #FFFFFF; /*tableBackgroundColor*/
}
.rich-combobox-list-scroll {
@@ -76,13 +85,14 @@
}
.rich-combobox-list-cord {
- position : relative;
- z-index:1000;
-}
+ position : relative;
+ font-size : 0px;
+}/*DDL is hidden!!!!!*/
.rich-combobox-item {
padding : 2px; white-space : nowrap;
width: 100%;
+ display: block;
}
@@ -162,6 +172,9 @@
</f:verbatim>
+
+
+
<u:selector name=".rich-combobox-button-background">
<u:style name="background-image">
<f:resource f:key="org.richfaces.renderkit.images.ComboBoxButtonGradient" />
@@ -245,6 +258,6 @@
<u:style name="border-color" skin="panelBorderColor"/>
<u:style name="background" skin="tableBackgroundColor"/>
</u:selector>
-
+
</f:template>
Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-11 15:34:00 UTC (rev 5304)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js 2008-01-11 15:35:43 UTC (rev 5305)
@@ -341,16 +341,17 @@
}
}
- if (Prototype.Browser.IE) {
+ /*if (Prototype.Browser.IE) {
height = parseInt(height) + Richfaces.ComboBoxList.LAYOUT_BORDER_V + Richfaces.ComboBoxList.LAYOUT_PADDING_V;
- }
- this.listParent.style.height = height;
+ }*/
+ //this.listParent.style.height = height;
+ this.list.style.height = height;
if (this.width) {
var width = this.width;
- if (Prototype.Browser.Gecko) {
+ /*if (Prototype.Browser.Gecko) {
width = parseInt(this.width) - Richfaces.ComboBoxList.LAYOUT_BORDER_H - Richfaces.ComboBoxList.LAYOUT_PADDING_H;
- }
+ }*/
this.listParent.style.width = width;
this.list.style.width = width;
}
@@ -374,28 +375,32 @@
scrolling : function(event) {
var increment;
- var listTop = Richfaces.ComboBoxList.getElemXY(this.listParent).top;
- var scrollTop = this.listParent.scrollTop;
+ //var scrollElem = this.listParent;
+ var scrollElem = this.list;
+ var listTop = Richfaces.ComboBoxList.getElemXY(scrollElem).top;
+ var scrollTop = scrollElem.scrollTop;
var itemTop = Richfaces.ComboBoxList.getElemXY(this.activeItem).top;
if ((event.keyCode == Event.KEY_UP) || (event.keyCode == 33)) {
increment = (itemTop - scrollTop) - listTop;
if (increment < 0) {
- this.listParent.scrollTop += increment;
+ scrollElem.scrollTop += increment;
}
} else if ((event.keyCode == Event.KEY_DOWN) || (event.keyCode == 34)) {
var itemBottom = itemTop + this.activeItem.offsetHeight;
- var increment = (itemBottom - scrollTop) - (listTop + this.listParent.clientHeight);
+ var increment = (itemBottom - scrollTop) - (listTop + scrollElem.clientHeight);
if (increment > 0) {
- this.listParent.scrollTop += increment;
+ scrollElem.scrollTop += increment;
}
}
Event.stop(event);
},
scrollingUpToItem : function(item) {
- var increment = (Richfaces.ComboBoxList.getElemXY(item).top - this.listParent.scrollTop) - Richfaces.ComboBoxList.getElemXY(this.listParent).top;
- this.listParent.scrollTop += increment;
+ //var scrollElem = this.listParent;
+ var scrollElem = this.list;
+ var increment = (Richfaces.ComboBoxList.getElemXY(item).top - scrollElem.scrollTop) - Richfaces.ComboBoxList.getElemXY(scrollElem).top;
+ scrollElem.scrollTop += increment;
},
/* items library*/
@@ -422,10 +427,10 @@
},
getEventItem : function(event) {
- var item = Event.findElement(event, "div");
- if ((item == null) || (item.id == this.listParent.id) || (item.id == this.list.id)) {
+ var item = Event.findElement(event, "span");
+ /*if ((item == null) || (item.id == this.listParent.id) || (item.id == this.list.id)) {
return;
- }
+ }*/
return item;
},
@@ -455,8 +460,10 @@
resetState : function() {
var tempList = this.list.cloneNode(false);
- this.listParent.replaceChild(tempList, this.listParent.firstChild);
- this.list = this.listParent.firstChild;
+ //this.listParent.replaceChild(tempList, this.listParent.firstChild);
+ this.listParent.childNodes[1].firstChild.replaceChild(tempList, this.list);
+ //this.list = this.listParent.firstChild;
+ this.list = $(tempList.id);
this.activeItem = null;
this.isList = false;
},
@@ -501,7 +508,7 @@
},
createItem : function(text, className) {
- return "<div class=" + className+ ">" + text + "</div>";
+ return "<span class=" + className+ ">" + text + "</span>";
}
}
Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-11 15:34:00 UTC (rev 5304)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx 2008-01-11 15:35:43 UTC (rev 5305)
@@ -158,30 +158,39 @@
</jsp:scriptlet>
<div id="#{clientId}" class="rich-combobox-font rich-combobox-shell #{styleClass}" style="width:#{listWidth}; #{style}">
- <input id="comboboxField#{clientId}"
- name="comboboxField#{clientId}"
- disabled="#{disabled}"
- class="rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}" type="text"
- value="#{value}"
- size="#{inputSize}"
- autocomplete="off"
- style="width:#{listWidth}; #{inputStyle}"
- x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled"
- >
- </input>
- <input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button">
- </input>
- <input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}" class="rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button #{buttonDisabledClass}"
- onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-button-pressed rich-combobox-font rich-combobox-button-icon';"
- onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-font rich-combobox-button-icon'"
- onmouseout="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button'"
- onmouseover="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'">
- </input>
- <input type="text" class="rich-combobox-strut rich-combobox-font" style="width:#{listWidth}">
- </input>
- <div id="listParent#{clientId}" style="display:none; #{listStyle};" class="rich-combobox-list-cord rich-combobox-list-scroll rich-combobox-list-decoration rich-combobox-list-position #{listClass}">
- <div id="list#{clientId}">
- <f:call name="encodeItems"/>
+ <div class="cb_width_field rich-combobox-font rich-combobox-shell">
+ <input id="comboboxField#{clientId}"
+ name="comboboxField#{clientId}"
+ disabled="#{disabled}"
+ class="cb_width_field rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}" type="text"
+ value="#{value}"
+ size="#{inputSize}"
+ autocomplete="off"
+ style="width:#{listWidth}; #{inputStyle}"
+ x:passThruWithExclusions="value,name,type,id,styleClass,class,style,size,autocomplete,disabled"
+ >
+ </input>
+ <input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button">
+ </input>
+ <input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}"
+ class="rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button #{buttonDisabledClass}"
+ onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-button-pressed rich-combobox-font rich-combobox-button-icon';"
+ onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button'; this.className='rich-combobox-button rich-combobox-font rich-combobox-button-icon'"
+ onmouseout="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button'"
+ onmouseover="this.className='rich-combobox-font rich-combobox-button-icon rich-combobox-button-hovered'">
+ </input>
+ <input type="text" class="cb_width_field rich-combobox-strut rich-combobox-font">
+ </input>
+ </div>
+
+ <div id="listParent#{clientId}" class="rich-combobox-list-cord #{listClass}" style="display:none; #{listStyle};">
+ <iframe class="rich-combobox-list-scroll rich-combobox-list-position" frameborder="0" style="width:#{listWidth};"/>
+ <div id="listPosition#{clientId}" class="rich-combobox-list-position" style="width:#{listWidth};">
+ <div id="listDecoration#{clientId}" class="rich-combobox-list-decoration">
+ <div id="list#{clientId}" class="rich-combobox-list-scroll">
+ <f:call name="encodeItems"/>
+ </div>
+ </div>
</div>
</div>
</div>
17 years