Author: pyaschenko
Date: 2010-12-08 06:29:25 -0500 (Wed, 08 Dec 2010)
New Revision: 20449
Modified:
trunk/core/impl/src/main/resources/META-INF/resources/jquery.position.js
trunk/examples/input-demo/src/main/java/org/richfaces/demo/CalendarBean.java
trunk/examples/input-demo/src/main/webapp/examples/calendar.xhtml
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
Log:
http://jira.jboss.com/jira/browse/RF-9648
offsets support also was added to jquery.position plugin
Modified: trunk/core/impl/src/main/resources/META-INF/resources/jquery.position.js
===================================================================
--- trunk/core/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-12-08
11:28:52 UTC (rev 20448)
+++ trunk/core/impl/src/main/resources/META-INF/resources/jquery.position.js 2010-12-08
11:29:25 UTC (rev 20449)
@@ -182,21 +182,6 @@
}
return rect;
- /*
- var jqe = $(element);
- var offset = jqe.offset();
- var width = jqe.width();
- var height = jqe.height();
- if (width == 0 && height==0) {
- //TODO: create getComputedStyle function for this
- var e = jqe.get(0);
- if (e.currentStyle) {
- width = parseInt(e.currentStyle['width'],10) || 0;
- height = parseInt(e.currentStyle['height'],10) || 0;
- }
- }
- return {width: width, height: height, left: Math.floor(offset.left), top:
Math.floor(offset.top)};
- */
};
function checkCollision (elementRect, windowRect) {
@@ -237,7 +222,6 @@
function getPositionRect(baseRect, rectOffset, elementDim, pos) {
var rect = {};
// TODO: add support for center and middle // may be middle rename to center too
- // TODO: add rectOffset support && tests
var v = pos.charAt(0);
if (v=='L') {
@@ -255,17 +239,21 @@
v = pos.charAt(2);
if (v=='L') {
+ rect.left -= rectOffset[0];
rect.right = rect.left;
rect.left -= elementDim.width;
} else if (v=='R') {
+ rect.left += rectOffset[0];
rect.right = rect.left + elementDim.width;
}
v = pos.charAt(3);
if (v=='T') {
+ rect.top -= rectOffset[1];
rect.bottom = rect.top;
rect.top -= elementDim.height;
} else if (v=='B') {
+ rect.top += rectOffset[1];
rect.bottom = rect.top + elementDim.height;
}
Modified: trunk/examples/input-demo/src/main/java/org/richfaces/demo/CalendarBean.java
===================================================================
---
trunk/examples/input-demo/src/main/java/org/richfaces/demo/CalendarBean.java 2010-12-08
11:28:52 UTC (rev 20448)
+++
trunk/examples/input-demo/src/main/java/org/richfaces/demo/CalendarBean.java 2010-12-08
11:29:25 UTC (rev 20449)
@@ -20,7 +20,9 @@
private String mode = "client";
private String jointPoint = "auto-auto";
private String direction = "auto-auto";
-
+ private int horizontalOffset = 0;
+ private int verticalOffset = 0;
+
public CalendarBean() {
locale = Locale.US;
@@ -110,4 +112,20 @@
return direction;
}
+ public void setHorizontalOffset(int horizontalOffset) {
+ this.horizontalOffset = horizontalOffset;
+ }
+
+ public int getHorizontalOffset() {
+ return horizontalOffset;
+ }
+
+ public void setVerticalOffset(int verticalOffset) {
+ this.verticalOffset = verticalOffset;
+ }
+
+ public int getVerticalOffset() {
+ return verticalOffset;
+ }
+
}
\ No newline at end of file
Modified: trunk/examples/input-demo/src/main/webapp/examples/calendar.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/calendar.xhtml 2010-12-08 11:28:52
UTC (rev 20448)
+++ trunk/examples/input-demo/src/main/webapp/examples/calendar.xhtml 2010-12-08 11:29:25
UTC (rev 20449)
@@ -58,7 +58,9 @@
onclean="return onEvent.call(this, event);"
ondatemouseout="return onEvent.call(this, event);"
ondatemouseover="return onEvent.call(this, event);"
-
+ firstWeekDay="4"
+ horizontalOffset="#{calendarBean.horizontalOffset}"
+ verticalOffset="#{calendarBean.verticalOffset}"
<f:ajax event="change"
render="echo-text" />
</calendar:calendar>
@@ -97,7 +99,7 @@
<h:selectOneMenu value="#{calendarBean.mode}"
onchange="submit()">
<f:selectItem itemValue="client"/>
<f:selectItem itemValue="ajax"/>
- </h:selectOneMenu><br/>
+ </h:selectOneMenu>
<h:outputText value="Select joint point:" />
<h:selectOneMenu value="#{calendarBean.jointPoint}">
@@ -116,7 +118,11 @@
<f:selectItem itemLabel="top-right" itemValue="top-right"
/>
<f:selectItem itemLabel="bottom-left" itemValue="bottom-left"
/>
<f:selectItem itemLabel="bottom-right"
itemValue="bottom-right" />
- </h:selectOneMenu>
+ </h:selectOneMenu>
+ <h:outputText value="Horisontal offset:" />
+ <h:inputText value="#{calendarBean.horizontalOffset}" />
+ <h:outputText value="Vertical offset:" />
+ <h:inputText value="#{calendarBean.verticalOffset}" />
</h:panelGrid>
<h:panelGroup layout="block">
<div>
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-08
11:28:52 UTC (rev 20448)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-12-08
11:29:25 UTC (rev 20449)
@@ -159,10 +159,10 @@
public abstract String getBoundaryDatesMode();
@Attribute(defaultValue = "0")
- public abstract String getHorizontalOffset();
+ public abstract int getHorizontalOffset();
@Attribute(defaultValue = "0")
- public abstract String getVerticalOffset();
+ public abstract int getVerticalOffset();
@Attribute(defaultValue = "3")
public abstract int getZindex();
Modified:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-08
11:28:52 UTC (rev 20448)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-12-08
11:29:25 UTC (rev 20449)
@@ -342,7 +342,7 @@
}
this.params.labels = value;
- this.popupOffset = {dx:this.params.horizontalOffset, dy:this.params.verticalOffset};
+ this.popupOffset = [this.params.horizontalOffset, this.params.verticalOffset];
//
if (!this.params.popup) this.params.showApplyButton = false;