You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by id...@apache.org on 2007/10/18 19:29:25 UTC

svn commit: r586037 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ example/demo/src/main/webapp/reference/ theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ them...

Author: idus
Date: Thu Oct 18 10:29:24 2007
New Revision: 586037

URL: http://svn.apache.org/viewvc?rev=586037&view=rev
Log:
TOBAGO-517: made popup background cover whole client area in IE and SELECT controls

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
    myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java?rev=586037&r1=586036&r2=586037&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlAttributes.java Thu Oct 18 10:29:24 2007
@@ -74,5 +74,6 @@
   public static final String MAXLENGTH = "maxlength";
   public static final String LABEL = "label";
   public static final String TABINDEX = "tabindex";
+  public static final String FRAMEBORDER = "frameborder";
 }
 

Modified: myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp?rev=586037&r1=586036&r2=586037&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.jsp Thu Oct 18 10:29:24 2007
@@ -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/>
@@ -94,6 +122,12 @@
         </f:facet>
       </tc:button>
       <tc:cell/>
+
+      <tc:cell/>
+      <tc:cell/>
+      
+      <tc:cell/>
+      <tx:selectOneChoice label="Select"/>
 
       <tc:cell/>
       <tc:cell/>

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java?rev=586037&r1=586036&r2=586037&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/PopupRenderer.java Thu Oct 18 10:29:24 2007
@@ -27,7 +27,9 @@
 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 @@
           + 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 @@
     writer.endElement(HtmlConstants.DIV);
 
     String setupScript = "Tobago.setupPopup('" + clientId + "', '"
-        + component.getLeft() + "', '" + component.getTop() + "');";
+        + component.getLeft() + "', '" + component.getTop() + "', " + component.isModal() + ");";
     writer.writeJavascript(setupScript);
   }
 

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css?rev=586037&r1=586036&r2=586037&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css Thu Oct 18 10:29:24 2007
@@ -525,11 +525,12 @@
 
 .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 {

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=586037&r1=586036&r2=586037&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Thu Oct 18 10:29:24 2007
@@ -810,7 +810,7 @@
   /**
     * 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 @@
     // 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 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 @@
   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';
     }
   },