ICEfaces
  1. ICEfaces
  2. ICE-3908

Add ability for ice:panelPopup to center itself once when it loads, but not ever again.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.2 SP1
    • Fix Version/s: 1.8RC1, 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      All

      Description

      Philip has the following application level code which will implement this functionality. There is a request for it to be added to the component code base, perhaps as a new attribute on panelPopup.

       String panelPopupClientId = "...";
       JavascriptContext
        .addJavascriptCall(
        FacesContext.getCurrentInstance(),
        "var div = document.getElementById('" + panelPopupClientId + "');"
        + "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, {position:'absolute'});"
        + "Element.setStyle(div, {left: x});"
        + "Element.setStyle(div, {top:y});"
        + "}");
       

        Activity

        Tyler Johnson created issue -
        Tyler Johnson made changes -
        Field Original Value New Value
        Salesforce Case [50070000007Z87m]
        Tyler Johnson made changes -
        Description Philip has the following application level code which will implement this functionality. Would be nice to have feature if it were incorporated in our code base.

         String panelPopupClientId = "...";
         JavascriptContext
          .addJavascriptCall(
          FacesContext.getCurrentInstance(),
          "var div = document.getElementById('" + panelPopupClientId + "');"
          + "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, {position:'absolute'});"
          + "Element.setStyle(div, {left: x});"
          + "Element.setStyle(div, {top:y});"
          + "}");
         
        Philip has the following application level code which will implement this functionality. There is a request for it to be added to the component code base, perhaps as a new attribute on panelPopup.

         String panelPopupClientId = "...";
         JavascriptContext
          .addJavascriptCall(
          FacesContext.getCurrentInstance(),
          "var div = document.getElementById('" + panelPopupClientId + "');"
          + "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, {position:'absolute'});"
          + "Element.setStyle(div, {left: x});"
          + "Element.setStyle(div, {top:y});"
          + "}");
         
        Tyler Johnson made changes -
        Attachment SC7845.war [ 11413 ]
        Ken Fyten made changes -
        Assignee Ken Fyten [ ken.fyten ]
        Hide
        Ken Fyten added a comment -

        I think what we want to do is have it so that if both the 'autocentre' or 'autoposition' attribute is set AND the 'draggable' attribute = true, then the autocentre or autoposition is only respected until the user drags the panel, after which it behaves like any other draggable panel (no autocentre or autoposition behavior).

        I might be best if the act of dragging the panel changes the value of autocentre and autoposition to false or null, effectively turning them off after the user drags the panel.

        Show
        Ken Fyten added a comment - I think what we want to do is have it so that if both the 'autocentre' or 'autoposition' attribute is set AND the 'draggable' attribute = true, then the autocentre or autoposition is only respected until the user drags the panel, after which it behaves like any other draggable panel (no autocentre or autoposition behavior). I might be best if the act of dragging the panel changes the value of autocentre and autoposition to false or null, effectively turning them off after the user drags the panel.
        Ken Fyten made changes -
        Assignee Priority P2
        Assignee Ken Fyten [ ken.fyten ] Yip Ng [ yip.ng ]
        Ken Fyten made changes -
        Affects [Documentation (User Guide, Ref. Guide, etc.)]
        Ken Fyten made changes -
        Fix Version/s 1.8DR#3 [ 10143 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18169 Wed Jan 14 10:20:26 MST 2009 yip.ng ICE-3908
        Added ability for ice:panelPopup to center itself once when it loads, but not ever again.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/GroupRenderer.java
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopupRenderer.java
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/panelpopup/PanelPopup.java
        Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-panelpopup-props.xml
        Hide
        yip.ng added a comment -

        Added attribute "positionOnLoadOnly" to control centering or positioning popup once on load only.

        Added internal flag to check when drag has been done and not render code for auto centering or auto positioning.

        Show
        yip.ng added a comment - Added attribute "positionOnLoadOnly" to control centering or positioning popup once on load only. Added internal flag to check when drag has been done and not render code for auto centering or auto positioning.
        yip.ng made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #18172 Wed Jan 14 13:06:35 MST 2009 mark.collette ICE-3908 : Added ability for ice:panelPopup to center itself once when it loads, but not ever again.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component-metadata/src/main/resources/conf/ice_cust_properties/cust-panelpopup-props.xml
        Ken Fyten made changes -
        Fix Version/s 1.8 [ 10161 ]
        Assignee Priority P2
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Yip Ng [ yip.ng ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: