myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [myfaces-tobago] 03/03: Backport TOBAGO-517: made popup background cover whole client area in IE and SELECT controls
Date Sat, 16 Sep 2017 05:46:46 GMT
This is an automated email from the ASF dual-hosted git repository.

deki pushed a commit to tag tobago-1.0.12
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 0971ab473ceec48c831e3efab02c0f6820a7f109
Author: Bernd Bohmann <bommel@apache.org>
AuthorDate: Thu Oct 18 18:37:31 2007 +0000

    Backport TOBAGO-517: made popup background cover whole client area in IE and SELECT controls
---
 .../tobago/renderkit/html/HtmlAttributes.java      |  1 +
 example/demo/src/main/webapp/reference/popup.jsp   | 38 ++++++++++++++++++++--
 .../scarborough/standard/tag/PopupRenderer.java    | 33 ++++++++++++++-----
 .../html/scarborough/standard/style/style.css      |  3 +-
 .../html/standard/standard/script/tobago.js        | 12 +++----
 5 files changed, 69 insertions(+), 18 deletions(-)

diff --git a/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
b/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
index 1b628dd..f5286f1 100644
--- a/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
+++ b/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
@@ -74,5 +74,6 @@ public final class HtmlAttributes {
   public static final String MAXLENGTH = "maxlength";
   public static final String LABEL = "label";
   public static final String TABINDEX = "tabindex";
+  public static final String FRAMEBORDER = "frameborder";
 }
 
diff --git a/example/demo/src/main/webapp/reference/popup.jsp b/example/demo/src/main/webapp/reference/popup.jsp
index 5ee7305..b339aa7 100644
--- a/example/demo/src/main/webapp/reference/popup.jsp
+++ b/example/demo/src/main/webapp/reference/popup.jsp
@@ -24,7 +24,7 @@
   <jsp:body>
     <tc:box label="Popups">
       <f:facet name="layout">
-        <tc:gridLayout columns="100px;*" rows="fixed;fixed;fixed;fixed;*"/>
+        <tc:gridLayout columns="100px;*" rows="fixed;fixed;fixed;fixed;*;fixed;*"/>
       </f:facet>
 
       <tc:button label="Open">
@@ -70,7 +70,35 @@
         </tc:menu>
       </tc:menuBar>
 
-      <tc:cell/>
+      <tc:button label="Open modeless">
+        <f:facet name="popup">
+          <tc:popup width="300" height="270" id="popup2" modal="false">
+            <tc:box label="Text input">
+              <f:facet name="layout">
+                <tc:gridLayout rows="fixed;*;fixed"/>
+              </f:facet>
+
+              <tx:in label="Field" required="true"/>
+              <tc:cell/>
+              <tc:panel>
+                <f:facet name="layout">
+                  <tc:gridLayout columns="*;fixed;fixed"/>
+                </f:facet>
+                <tc:cell/>
+                <tc:button label="Cancel">
+                  <tc:attribute name="popupClose" value="immediate"/>
+                </tc:button>
+                <tc:button label="Ok">
+                  <tc:attribute name="popupClose" value="afterSubmit"/>
+                </tc:button>
+              </tc:panel>
+
+            </tc:box>
+          </tc:popup>
+        </f:facet>
+      </tc:button>
+
+
       <tc:out value="here is the boolean >>#{reference.bool}<<"/>
 
       <tc:cell/>
@@ -97,6 +125,12 @@
 
       <tc:cell/>
       <tc:cell/>
+      
+      <tc:cell/>
+      <tx:selectOneChoice label="Select"/>
+
+      <tc:cell/>
+      <tc:cell/>
 
     </tc:box>
   </jsp:body>
diff --git a/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
b/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
index 3cf3ce9..170c923 100644
--- a/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
+++ b/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
@@ -27,7 +27,9 @@ import org.apache.commons.logging.LogFactory;
 import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
 import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
 import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
+import org.apache.myfaces.tobago.component.ComponentUtil;
 import org.apache.myfaces.tobago.component.UIPopup;
+import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.renderkit.LayoutableRendererBase;
@@ -95,20 +97,33 @@ public class PopupRenderer extends LayoutableRendererBase implements AjaxRendere
           + bgImage + "', sizingMethod='scale');", false);
       }
       writer.endElement(HtmlConstants.DIV);
-      if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
-        writer.startElement(HtmlConstants.IFRAME, component);
-        writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + HtmlConstants.IFRAME);
-        writer.writeClassAttribute("tobago-popup-iframe tobago-popup-none");
-        writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), false);
-        writer.writeAttribute(HtmlAttributes.SRC, "javascript:false;", false);
-        writer.endElement(HtmlConstants.IFRAME);
+    }
+    if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
+      writer.startElement(HtmlConstants.IFRAME, component);
+      writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + HtmlConstants.IFRAME);
+      writer.writeClassAttribute("tobago-popup-iframe tobago-popup-none");
+      UIPage page = ComponentUtil.findPage(facesContext);
+      final StringBuilder frameSize = new StringBuilder();
+      if (component.isModal()) {
+        // full client area
+        frameSize.append("width: ");
+        frameSize.append(page.getWidth());
+        frameSize.append("; ");
+        frameSize.append("height: ");
+        frameSize.append(page.getHeight());
+        frameSize.append("; ");
+      } else {
+        frameSize.append(contentStyle); // size of the popup
       }
+      writer.writeAttribute(HtmlAttributes.STYLE, frameSize.toString(), false);
+      writer.writeAttribute(HtmlAttributes.SRC, "javascript:false;", false);
+      writer.writeAttribute(HtmlAttributes.FRAMEBORDER, "0", false);
+      writer.endElement(HtmlConstants.IFRAME);
     }
     writer.startElement(HtmlConstants.DIV, component);
     writer.writeIdAttribute(contentDivId);
     writer.writeClassAttribute("tobago-popup-content tobago-popup-none");
 
-
     writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), false);
   }
 
@@ -121,7 +136,7 @@ public class PopupRenderer extends LayoutableRendererBase implements AjaxRendere
     writer.endElement(HtmlConstants.DIV);
 
     String setupScript = "Tobago.setupPopup('" + clientId + "', '"
-        + component.getLeft() + "', '" + component.getTop() + "');";
+        + component.getLeft() + "', '" + component.getTop() + "', " + component.isModal()
+ ");";
     writer.writeJavascript(setupScript);
   }
 
diff --git a/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
b/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
index 1382d7b..ec70c63 100644
--- a/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
+++ b/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
@@ -525,11 +525,12 @@ label.tobago-label-inline {
 
 .tobago-popup-iframe {
   z-index: 2;
+  position: absolute;
   width: 100%;
   height: 100%;
-  position: absolute;
   top: 0px;
   left: 0px;
+  filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
 }
 
 .tobago-popup-content {
diff --git a/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
b/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
index 8b758b7..6c8132c 100644
--- a/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
+++ b/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
@@ -810,7 +810,7 @@ var Tobago = {
   /**
     * Setup popup size
     */
-  setupPopup: function(id, left, top) {
+  setupPopup: function(id, left, top, modal) {
 //  alert("tobagoSetupPopup('" + id + "', '" + left + "', '"+ top + "')");
     var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "hidden");
     if (hidden && hidden.type == "hidden") {
@@ -820,8 +820,8 @@ var Tobago = {
     // extend background into scrollable area
     var background = this.element(id);
     if (background) {
-      background.style.width = document.body.scrollWidth + 'px';
-      background.style.height = document.body.scrollHeight + 'px';
+      background.style.width = Math.max(document.body.scrollWidth, document.body.clientWidth)
+ 'px';
+      background.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight)
+ 'px';
       this.popupResizeStub = function() {Tobago.doResizePopupBackground(id);}
       Tobago.addEventListener(window, "resize", this.popupResizeStub);
     }
@@ -863,7 +863,7 @@ var Tobago = {
 
       var iframeId = id + Tobago.SUB_COMPONENT_SEP + "iframe";
       var iframe = this.element(iframeId);
-      if (iframe) {
+      if (iframe && !modal) {
         iframe.style.left = div.style.left;
         iframe.style.top = div.style.top;
       }
@@ -880,8 +880,8 @@ var Tobago = {
   doResizePopupBackground: function(id) {
     var background = Tobago.element(id);
     if (background) {
-      background.style.width = document.body.scrollWidth + 'px';
-      background.style.height = document.body.scrollHeight + 'px';
+      background.style.width = Math.max(document.body.scrollWidth, document.body.clientWidth)
+ 'px';
+      background.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight)
+ 'px';
     }
   },
 

-- 
To stop receiving notification emails like this one, please contact
"commits@myfaces.apache.org" <commits@myfaces.apache.org>.

Mime
View raw message