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
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
-
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
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 @@
- The current modal state.
*/
private Boolean modal = null;
+ /**
+ * The current autoCentre state.
+ */
+ private Boolean autoCentre = null;
- /**
+ public boolean isAutoCentre()Unknown macro: {+ if (autoCentre != null) { + return autoCentre.booleanValue(); + }+ ValueBinding vb = getValueBinding("autoCentre");+ Boolean boolVal =+ vb != null ? (Boolean) vb.getValue(getFacesContext()) }+
{ + this.autoCentre = Boolean.valueOf(autoCentre); + }
+ public void setAutoCentre(boolean autoCentre)+
+ private String autoPosition = null;
+
+ public String getAutoPosition()Unknown macro: {+ if (autoPosition != null) { + return autoPosition; + }+ ValueBinding vb = getValueBinding("autoPosition");+ return vb != null ? (String) vb.getValue(getFacesContext()) }+
{ + this.autoPosition = val; + }
+ public void setAutoPosition(String val)+
+ /**
- Creates an instance and sets renderer type to "com.icesoft.faces.PanelPopup".
*/
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 + "');";
+ 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);
-
+
+
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();
+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,
);
+ Element.setStyle(div,
);
+ Element.setStyle(div,
);
+ }
+
+
+ },
+ start:function(target)
,
+ stop:function(target) {
+ if (Ice.autoCentre.id == target)
+ }
+};
+
+
+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,
);
+ Element.setStyle(div,
);
+ Element.setStyle(div,
);
+ }
+
+
+ },
+ start:function(target,x,y)
,
+ stop:function(target) {
+ if (Ice.autoPosition.id == target)
+ }
+};
+
+
+
Keep popup panel invisible while calculating its postion.