Details
-
Type: New Feature
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.7DR#2
-
Fix Version/s: 1.7Beta1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:n/a
-
Assignee Priority:P2
-
Affects:Documentation (User Guide, Ref. Guide, etc.), Sample App./Tutorial
Description
autoCentre:
This new attribute would have the effect of maintaining the popup in the centre of the screen whether the user resized the browser or scrolled the document.
autoPosition:
This attribute, declaring an x & y value for the placement of the popup in px, would have the effect of maintaining the position through scroll events
This new attribute would have the effect of maintaining the popup in the centre of the screen whether the user resized the browser or scrolled the document.
autoPosition:
This attribute, declaring an x & y value for the placement of the popup in px, would have the effect of maintaining the position through scroll events
Issue Links
- is duplicated by
-
ICE-2592 Always visible component/panel
- Closed
suggested impl:
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopup.java
===================================================================
— D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopup.java (revision 15197)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopup.java (working copy)
@@ -100,8 +100,40 @@
*/
private Boolean modal = null;
+ /**
+ * The current autoCentre state.
+ */
+ private Boolean autoCentre = null;
+ public boolean isAutoCentre()
+
{ + this.autoCentre = Boolean.valueOf(autoCentre); + }+ public void setAutoCentre(boolean autoCentre)
+
+ private String autoPosition = null;
+
+ public String getAutoPosition()
+
{ + this.autoPosition = val; + }+ public void setAutoPosition(String val)
+
+ /**
*/
public PanelPopup() { Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopupRenderer.java =================================================================== --- D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopupRenderer.java (revision 15197) +++ D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopupRenderer.java (working copy) @@ -223,6 +223,32 @@ String call = addJavascriptCalls(uiComponent, "DRAG", handleId, facesContext); JavascriptContext.addJavascriptCall(facesContext, call); }
+
{ + String positions = panelPopup.getAutoPosition(); + String x = positions.substring(0,positions.indexOf(',')); + String y = positions.substring(positions.indexOf(',')+1); + autoPositionJS = "Ice.autoPosition.start('" + clientId + "'," + x + "," + y +");"; + }+ //autoPosition handling
+ String autoPositionJS = null;
+ if( panelPopup.getAutoPosition() != null )
+ else
{ + autoPositionJS = "Ice.autoPosition.stop('" + clientId + "');"; + }+ JavascriptContext.addJavascriptCall(facesContext, autoPositionJS);
{ + centreJS = "Ice.autoCentre.start('" + clientId + "');"; + + }+
+ //autoCentre handling
+ boolean autoCentre = panelPopup.isAutoCentre();
+ String centreJS;
+ if( autoCentre )
+ else
{ + centreJS = "Ice.autoCentre.stop('" + clientId + "');"; + }+ JavascriptContext.addJavascriptCall(facesContext, centreJS);
+
}
private String modalJavascript(Boolean modal, Boolean visible,
@@ -230,7 +256,8 @@
String call = null;
if (modal != null) {
if (modal.booleanValue() && visible.booleanValue()) {
+ call = "Ice.modal.start('" + clientId + "');";
+
if (log.isTraceEnabled()) { log.trace("Starting Modal Function"); }
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-panelpopup-props.xml
===================================================================
— D:/Documents and Settings/pbreau/workspace/ICEfaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-panelpopup-props.xml (revision 15197)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-panelpopup-props.xml (working copy)
@@ -111,4 +111,24 @@
<property-extension>
<category>ICE_LAYOUT</category>
</property-extension>
+</property>
+<property>
+ <description>Used to keep the popup centred on the screen through
+ scrolling and window resizing events.
+ </description>
+ <property-name>autoCentre</property-name>
+ <property-class>boolean</property-class>
+ <property-extension>
+ <category>ICE_LAYOUT</category>
+ </property-extension>
+</property>
+<property>
+ <description>Used to keep the popup positioned on the screen through
+ scrolling events. Use a string of x and y px values (e.g. autoPostion="35,200").
+ </description>
+ <property-name>autoPosition</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <category>ICE_LAYOUT</category>
+ </property-extension>
</property>
\ No newline at end of file
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/bridge/lib/extras/style.js
===================================================================
— D:/Documents and Settings/pbreau/workspace/ICEfaces/bridge/lib/extras/style.js (revision 15197)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/bridge/lib/extras/style.js (working copy)
@@ -139,9 +139,11 @@
}
var modal = document.getElementById(target);
{ @@ -200,3 +203,73 @@ }-
+
+
modal.style.zIndex = parseInt(iframe.style.zIndex) + 1;
Ice.modal.target = modal;
+
Ice.modal.id = target;
Ice.modal.running = true;
modal.style.visibility = 'visible';
@@ -155,6 +157,7 @@
logger.debug('removed modal iframe for : ' + target);
}
Ice.modal.running = false;
+
}
},
keypress:function(event)
;
+Ice.autoCentre = Class.create();
{position:'absolute'}+Ice.autoCentre = {
+ id:null,
+ keepCentred:function(){
+ var scrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
+ var scrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
+ var div = document.getElementById(Ice.autoCentre.id);
+ if( div ){
+ var x = Math.round( (Element.getWidth(document.body) - Element.getWidth(div)) / 2 + scrollX );
+ if( x < 0 ) x = 0;
+ var y = Math.round( ((window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight) - Element.getHeight(div)) / 2 + scrollY );
+ if( y < 0 ) y = 0;
+ x = x + "px"; y = y + "px";
+ Element.setStyle(div,
);
{left: x}+ Element.setStyle(div,
);
{top:y}+ Element.setStyle(div,
);
{ + Ice.autoCentre.id = target; + Ice.autoCentre.keepCentred(); + Event.observe(window, 'resize', Ice.autoCentre.keepCentred); + Event.observe(window, 'scroll', Ice.autoCentre.keepCentred); + }+ }
+
+
+ },
+ start:function(target)
,
{ + Event.stopObserving(window, 'resize', Ice.autoCentre.keepCentred); + Event.stopObserving(window, 'scroll', Ice.autoCentre.keepCentred); + }+ stop:function(target) {
+ if (Ice.autoCentre.id == target)
+ }
{position:'absolute'}+};
+
+
+Ice.autoPosition = Class.create();
+Ice.autoPosition = {
+ id:null,
+ xPos:null,
+ yPos:null,
+ keepPositioned:function(){
+ var scrollX = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;
+ var scrollY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
+ var div = document.getElementById(Ice.autoPosition.id);
+ if( div ){
+ var x = Math.round( Ice.autoPosition.xPos + scrollX ) + "px";
+ var y = Math.round( Ice.autoPosition.yPos + scrollY ) + "px";
+ Element.setStyle(div,
);
{left: x}+ Element.setStyle(div,
);
{top:y}+ Element.setStyle(div,
);
{ + Ice.autoPosition.id = target; + Ice.autoPosition.xPos = x; + Ice.autoPosition.yPos = y; + Ice.autoPosition.keepPositioned(); + Event.observe(window, 'scroll', Ice.autoPosition.keepPositioned); + }+ }
+
+
+ },
+ start:function(target,x,y)
,
{ + Event.stopObserving(window, 'scroll', Ice.autoPosition.keepPositioned); + }+ stop:function(target) {
+ if (Ice.autoPosition.id == target)
+ }
+};
+
+
+