myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r927912 - in /myfaces/tobago/trunk: example/demo/src/main/webapp/reference/ example/test/src/main/java/org/apache/myfaces/tobago/example/test/ example/test/src/main/webapp/WEB-INF/ example/test/src/main/webapp/tc/popup/ theme/scarborough/sr...
Date Fri, 26 Mar 2010 15:21:40 GMT
Author: lofwyr
Date: Fri Mar 26 15:21:39 2010
New Revision: 927912

URL: http://svn.apache.org/viewvc?rev=927912&view=rev
Log:
Rewriting of the client code for the Popup
Related issues: TOBAGO-134, TOBAGO-852
Added samples.

Added:
    myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ZIndexController.java
Modified:
    myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.xhtml
    myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/test/src/main/webapp/tc/popup/z-index.xhtml
    myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
    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/script/tobago-menu.js
    myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/style.css
    myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/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/example/demo/src/main/webapp/reference/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.xhtml?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.xhtml (original)
+++ myfaces/tobago/trunk/example/demo/src/main/webapp/reference/popup.xhtml Fri Mar 26 15:21:39 2010
@@ -24,9 +24,12 @@
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core">
   <ui:param name="title" value="#{overviewBundle.basic}"/>
+
+  <ui:debug/>
+
   <tc:box label="Popups">
     <f:facet name="layout">
-      <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;fixed;*"/>
+      <tc:gridLayout rows="fixed;fixed;fixed;fixed;fixed;fixed;fixed;*"/>
     </f:facet>
 
     <tc:menuBar>
@@ -37,10 +40,6 @@
       </tc:menu>
     </tc:menuBar>
 
-    <ui:debug/>
-    
-    <tc:messages/>
-
     <tc:panel>
       <f:facet name="layout">
         <tc:gridLayout columns="fixed;fixed;fixed;fixed;*"/>

Added: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ZIndexController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ZIndexController.java?rev=927912&view=auto
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ZIndexController.java (added)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/ZIndexController.java Fri Mar 26 15:21:39 2010
@@ -0,0 +1,40 @@
+package org.apache.myfaces.tobago.example.test;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class ZIndexController {
+
+  private Boolean modal1 = true;
+  private Boolean modal2 = true;
+
+  public Boolean getModal1() {
+    return modal1;
+  }
+
+  public void setModal1(Boolean modal1) {
+    this.modal1 = modal1;
+  }
+
+  public Boolean getModal2() {
+    return modal2;
+  }
+
+  public void setModal2(Boolean modal2) {
+    this.modal2 = modal2;
+  }
+}

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/WEB-INF/faces-config.xml Fri Mar 26 15:21:39 2010
@@ -101,6 +101,12 @@
     <managed-bean-scope>session</managed-bean-scope>
   </managed-bean>
 
+  <managed-bean>
+    <managed-bean-name>zIndex</managed-bean-name>
+    <managed-bean-class>org.apache.myfaces.tobago.example.test.ZIndexController</managed-bean-class>
+    <managed-bean-scope>session</managed-bean-scope>
+  </managed-bean>
+
   <navigation-rule>
     <navigation-case>
       <from-outcome>navigation</from-outcome>

Modified: myfaces/tobago/trunk/example/test/src/main/webapp/tc/popup/z-index.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/webapp/tc/popup/z-index.xhtml?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/webapp/tc/popup/z-index.xhtml (original)
+++ myfaces/tobago/trunk/example/test/src/main/webapp/tc/popup/z-index.xhtml Fri Mar 26 15:21:39 2010
@@ -7,333 +7,374 @@
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:f="http://java.sun.com/jsf/core">
 
-  <tc:page width="800px" height="600px" id="page">
+<tc:page width="800px" height="600px" id="page">
 <f:facet xmlns:f="http://java.sun.com/jsf/core"
          xmlns:tc="http://myfaces.apache.org/tobago/component"
          xmlns:tx="http://myfaces.apache.org/tobago/extension"
          xmlns:tf="http://myfaces.apache.org/tobago/facelet-extension"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          name="menuBar">
-  <tc:menuBar>
-    <tc:menu label="space -> space -> space">
-    </tc:menu>
+<tc:menuBar>
+<tc:menu label="space -> space -> space">
+</tc:menu>
 
-    <tc:menu label="Help">
-      <tc:menu label="Help 1">
-        <tc:menu label="Help 1 1">
-        </tc:menu>
-        <tc:menuSeparator/>
-        <tc:menu label="Help 1 2">
-        </tc:menu>
-        <tc:menu label="Help 1 3">
-        </tc:menu>
-        <tc:menu label="Help 1 4">
-        </tc:menu>
-        <tc:menuSeparator/>
-        <tc:menu label="Help 1 5">
-        </tc:menu>
-        <tc:menu label="Help 1 6">
-        </tc:menu>
-        <tc:menu label="Help 1 7">
-        </tc:menu>
-        <tc:menuSeparator/>
-        <tc:menu label="Help 1 8">
-        </tc:menu>
-        <tc:menu label="Help 1 9">
-        </tc:menu>
-        <tc:menu label="Help 1 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 2">
-        <tc:menu label="Help 2 1">
-        </tc:menu>
-        <tc:menu label="Help 2 2">
-        </tc:menu>
-        <tc:menu label="Help 2 3">
-        </tc:menu>
-        <tc:menu label="Help 2 4">
-        </tc:menu>
-        <tc:menu label="Help 2 5">
-        </tc:menu>
-        <tc:menu label="Help 2 6">
-        </tc:menu>
-        <tc:menu label="Help 2 7">
-        </tc:menu>
-        <tc:menu label="Help 2 8">
-        </tc:menu>
-        <tc:menu label="Help 2 9">
-        </tc:menu>
-        <tc:menu label="Help 2 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 3">
-        <tc:menu label="Help 3 1">
-        </tc:menu>
-        <tc:menu label="Help 3 2">
-        </tc:menu>
-        <tc:menu label="Help 3 3">
-        </tc:menu>
-        <tc:menu label="Help 3 4">
-        </tc:menu>
-        <tc:menu label="Help 3 5">
-        </tc:menu>
-        <tc:menu label="Help 3 6">
-        </tc:menu>
-        <tc:menu label="Help 3 7">
-        </tc:menu>
-        <tc:menu label="Help 3 8">
-        </tc:menu>
-        <tc:menu label="Help 3 9">
-        </tc:menu>
-        <tc:menu label="Help 3 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 4">
-        <tc:menu label="Help 4 1">
-        </tc:menu>
-        <tc:menu label="Help 4 2">
-        </tc:menu>
-        <tc:menu label="Help 4 3">
-        </tc:menu>
-        <tc:menu label="Help 4 4">
-        </tc:menu>
-        <tc:menu label="Help 4 5">
-        </tc:menu>
-        <tc:menu label="Help 4 6">
-        </tc:menu>
-        <tc:menu label="Help 4 7">
-        </tc:menu>
-        <tc:menu label="Help 4 8">
-        </tc:menu>
-        <tc:menu label="Help 4 9">
-        </tc:menu>
-        <tc:menu label="Help 4 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 5">
-        <tc:menu label="Help 5 1">
-        </tc:menu>
-        <tc:menu label="Help 5 2">
-        </tc:menu>
-        <tc:menu label="Help 5 3">
-        </tc:menu>
-        <tc:menu label="Help 5 4">
-        </tc:menu>
-        <tc:menu label="Help 5 5">
-        </tc:menu>
-        <tc:menu label="Help 5 6">
-        </tc:menu>
-        <tc:menu label="Help 5 7">
-        </tc:menu>
-        <tc:menu label="Help 5 8">
-        </tc:menu>
-        <tc:menu label="Help 5 9">
-        </tc:menu>
-        <tc:menu label="Help 5 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 6">
-        <tc:menu label="Help 6 1">
-        </tc:menu>
-        <tc:menu label="Help 6 2">
-        </tc:menu>
-        <tc:menu label="Help 6 3">
-        </tc:menu>
-        <tc:menu label="Help 6 4">
-        </tc:menu>
-        <tc:menu label="Help 6 5">
-        </tc:menu>
-        <tc:menu label="Help 6 6">
-        </tc:menu>
-        <tc:menu label="Help 6 7">
-        </tc:menu>
-        <tc:menu label="Help 6 8">
-        </tc:menu>
-        <tc:menu label="Help 6 9">
-        </tc:menu>
-        <tc:menu label="Help 6 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 7">
-        <tc:menu label="Help 7 1">
-        </tc:menu>
-        <tc:menu label="Help 7 2">
-        </tc:menu>
-        <tc:menu label="Help 7 3">
-        </tc:menu>
-        <tc:menu label="Help 7 4">
-        </tc:menu>
-        <tc:menu label="Help 7 5">
-        </tc:menu>
-        <tc:menu label="Help 7 6">
-        </tc:menu>
-        <tc:menu label="Help 7 7">
-        </tc:menu>
-        <tc:menu label="Help 7 8">
-        </tc:menu>
-        <tc:menu label="Help 7 9">
-        </tc:menu>
-        <tc:menu label="Help 7 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 8">
-        <tc:menu label="Help 8 1">
-        </tc:menu>
-        <tc:menu label="Help 8 2">
-        </tc:menu>
-        <tc:menu label="Help 8 3">
-        </tc:menu>
-        <tc:menu label="Help 8 4">
-        </tc:menu>
-        <tc:menu label="Help 8 5">
-        </tc:menu>
-        <tc:menu label="Help 8 6">
-        </tc:menu>
-        <tc:menu label="Help 8 7">
-        </tc:menu>
-        <tc:menu label="Help 8 8">
-        </tc:menu>
-        <tc:menu label="Help 8 9">
-        </tc:menu>
-        <tc:menu label="Help 8 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 9">
-        <tc:menu label="Help 9 1">
-        </tc:menu>
-        <tc:menu label="Help 9 2">
-        </tc:menu>
-        <tc:menu label="Help 9 3">
-        </tc:menu>
-        <tc:menu label="Help 9 4">
-        </tc:menu>
-        <tc:menu label="Help 9 5">
-        </tc:menu>
-        <tc:menu label="Help 9 6">
-        </tc:menu>
-        <tc:menu label="Help 9 7">
-        </tc:menu>
-        <tc:menu label="Help 9 8">
-        </tc:menu>
-        <tc:menu label="Help 9 9">
-        </tc:menu>
-        <tc:menu label="Help 9 10">
-        </tc:menu>
-      </tc:menu>
-      <tc:menu label="Help 10">
-        <tc:menu label="Help 10 1">
-        </tc:menu>
-        <tc:menu label="Help 10 2">
-        </tc:menu>
-        <tc:menu label="Help 10 3">
-        </tc:menu>
-        <tc:menu label="Help 10 4">
-        </tc:menu>
-        <tc:menu label="Help 10 5">
-        </tc:menu>
-        <tc:menu label="Help 10 6">
-        </tc:menu>
-        <tc:menu label="Help 10 7">
-        </tc:menu>
-        <tc:menu label="Help 10 8">
-        </tc:menu>
-        <tc:menu label="Help 10 9">
-        </tc:menu>
-        <tc:menu label="Help 10 10">
-        </tc:menu>
-      </tc:menu>
-    </tc:menu>
-  </tc:menuBar>
+<tc:menu label="Help">
+<tc:menu label="Help 1">
+  <tc:menu label="Help 1 1">
+  </tc:menu>
+  <tc:menuSeparator/>
+  <tc:menu label="Help 1 2">
+  </tc:menu>
+  <tc:menu label="Help 1 3">
+  </tc:menu>
+  <tc:menu label="Help 1 4">
+  </tc:menu>
+  <tc:menuSeparator/>
+  <tc:menu label="Help 1 5">
+  </tc:menu>
+  <tc:menu label="Help 1 6">
+  </tc:menu>
+  <tc:menu label="Help 1 7">
+  </tc:menu>
+  <tc:menuSeparator/>
+  <tc:menu label="Help 1 8">
+  </tc:menu>
+  <tc:menu label="Help 1 9">
+  </tc:menu>
+  <tc:menu label="Help 1 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 2">
+  <tc:menu label="Help 2 1">
+  </tc:menu>
+  <tc:menu label="Help 2 2">
+  </tc:menu>
+  <tc:menu label="Help 2 3">
+  </tc:menu>
+  <tc:menu label="Help 2 4">
+  </tc:menu>
+  <tc:menu label="Help 2 5">
+  </tc:menu>
+  <tc:menu label="Help 2 6">
+  </tc:menu>
+  <tc:menu label="Help 2 7">
+  </tc:menu>
+  <tc:menu label="Help 2 8">
+  </tc:menu>
+  <tc:menu label="Help 2 9">
+  </tc:menu>
+  <tc:menu label="Help 2 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 3">
+  <tc:menu label="Help 3 1">
+  </tc:menu>
+  <tc:menu label="Help 3 2">
+  </tc:menu>
+  <tc:menu label="Help 3 3">
+  </tc:menu>
+  <tc:menu label="Help 3 4">
+  </tc:menu>
+  <tc:menu label="Help 3 5">
+  </tc:menu>
+  <tc:menu label="Help 3 6">
+  </tc:menu>
+  <tc:menu label="Help 3 7">
+  </tc:menu>
+  <tc:menu label="Help 3 8">
+  </tc:menu>
+  <tc:menu label="Help 3 9">
+  </tc:menu>
+  <tc:menu label="Help 3 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 4">
+  <tc:menu label="Help 4 1">
+  </tc:menu>
+  <tc:menu label="Help 4 2">
+  </tc:menu>
+  <tc:menu label="Help 4 3">
+  </tc:menu>
+  <tc:menu label="Help 4 4">
+  </tc:menu>
+  <tc:menu label="Help 4 5">
+  </tc:menu>
+  <tc:menu label="Help 4 6">
+  </tc:menu>
+  <tc:menu label="Help 4 7">
+  </tc:menu>
+  <tc:menu label="Help 4 8">
+  </tc:menu>
+  <tc:menu label="Help 4 9">
+  </tc:menu>
+  <tc:menu label="Help 4 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 5">
+  <tc:menu label="Help 5 1">
+  </tc:menu>
+  <tc:menu label="Help 5 2">
+  </tc:menu>
+  <tc:menu label="Help 5 3">
+  </tc:menu>
+  <tc:menu label="Help 5 4">
+  </tc:menu>
+  <tc:menu label="Help 5 5">
+  </tc:menu>
+  <tc:menu label="Help 5 6">
+  </tc:menu>
+  <tc:menu label="Help 5 7">
+  </tc:menu>
+  <tc:menu label="Help 5 8">
+  </tc:menu>
+  <tc:menu label="Help 5 9">
+  </tc:menu>
+  <tc:menu label="Help 5 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 6">
+  <tc:menu label="Help 6 1">
+  </tc:menu>
+  <tc:menu label="Help 6 2">
+  </tc:menu>
+  <tc:menu label="Help 6 3">
+  </tc:menu>
+  <tc:menu label="Help 6 4">
+  </tc:menu>
+  <tc:menu label="Help 6 5">
+  </tc:menu>
+  <tc:menu label="Help 6 6">
+  </tc:menu>
+  <tc:menu label="Help 6 7">
+  </tc:menu>
+  <tc:menu label="Help 6 8">
+  </tc:menu>
+  <tc:menu label="Help 6 9">
+  </tc:menu>
+  <tc:menu label="Help 6 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 7">
+  <tc:menu label="Help 7 1">
+  </tc:menu>
+  <tc:menu label="Help 7 2">
+  </tc:menu>
+  <tc:menu label="Help 7 3">
+  </tc:menu>
+  <tc:menu label="Help 7 4">
+  </tc:menu>
+  <tc:menu label="Help 7 5">
+  </tc:menu>
+  <tc:menu label="Help 7 6">
+  </tc:menu>
+  <tc:menu label="Help 7 7">
+  </tc:menu>
+  <tc:menu label="Help 7 8">
+  </tc:menu>
+  <tc:menu label="Help 7 9">
+  </tc:menu>
+  <tc:menu label="Help 7 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 8">
+  <tc:menu label="Help 8 1">
+  </tc:menu>
+  <tc:menu label="Help 8 2">
+  </tc:menu>
+  <tc:menu label="Help 8 3">
+  </tc:menu>
+  <tc:menu label="Help 8 4">
+  </tc:menu>
+  <tc:menu label="Help 8 5">
+  </tc:menu>
+  <tc:menu label="Help 8 6">
+  </tc:menu>
+  <tc:menu label="Help 8 7">
+  </tc:menu>
+  <tc:menu label="Help 8 8">
+  </tc:menu>
+  <tc:menu label="Help 8 9">
+  </tc:menu>
+  <tc:menu label="Help 8 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 9">
+  <tc:menu label="Help 9 1">
+  </tc:menu>
+  <tc:menu label="Help 9 2">
+  </tc:menu>
+  <tc:menu label="Help 9 3">
+  </tc:menu>
+  <tc:menu label="Help 9 4">
+  </tc:menu>
+  <tc:menu label="Help 9 5">
+  </tc:menu>
+  <tc:menu label="Help 9 6">
+  </tc:menu>
+  <tc:menu label="Help 9 7">
+  </tc:menu>
+  <tc:menu label="Help 9 8">
+  </tc:menu>
+  <tc:menu label="Help 9 9">
+  </tc:menu>
+  <tc:menu label="Help 9 10">
+  </tc:menu>
+</tc:menu>
+<tc:menu label="Help 10">
+  <tc:menu label="Help 10 1">
+  </tc:menu>
+  <tc:menu label="Help 10 2">
+  </tc:menu>
+  <tc:menu label="Help 10 3">
+  </tc:menu>
+  <tc:menu label="Help 10 4">
+  </tc:menu>
+  <tc:menu label="Help 10 5">
+  </tc:menu>
+  <tc:menu label="Help 10 6">
+  </tc:menu>
+  <tc:menu label="Help 10 7">
+  </tc:menu>
+  <tc:menu label="Help 10 8">
+  </tc:menu>
+  <tc:menu label="Help 10 9">
+  </tc:menu>
+  <tc:menu label="Help 10 10">
+  </tc:menu>
+</tc:menu>
+</tc:menu>
+</tc:menuBar>
 
-</f:facet>    <tc:box label="Page (z-index = 1 (TODO))">
-      <f:facet name="layout">
-        <tc:gridLayout rows="60px;fixed;*;fixed"/>
-      </f:facet>
-      <tc:out
-          value="This page is to check, if the layered presentation is corret. It will be usually defined by setting
+</f:facet>
+
+<tc:box label="Page (z-index = 0)">
+  <f:facet name="layout">
+    <tc:gridLayout rows="60px;auto;auto;*;auto;auto"/>
+  </f:facet>
+  <tc:out
+      value="This page is to check, if the layered presentation is corret. It will be usually defined by setting
            the z-index in CSS or by the order of rendering in the document. The footer and header of the sheet
            also have the z-index set in the common renderer."/>
-      <tx:date label="Date">
-        <f:convertDateTime pattern="dd/MM/yyyy"/>
-      </tx:date>
-      <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right" showDirectLinks="center">
-        <tc:column label="Column 1"/>
-        <tc:column label="Column 2"/>
-        <tc:column label="Column 3"/>
-      </tc:sheet>
-      <tc:panel>
-        <f:facet name="layout">
-          <tc:gridLayout columns="3*;*"/>
-        </f:facet>
-        <tc:cell/>
-        <tc:button label="Open Popup">
-          <f:facet name="popup">
-            <tc:popup width="600px" height="470px" left="100px" top="100px" id="popup-2">
-              <tc:box label="Popup (z-index = 2 (TODO))" id="box-2">
-                <f:facet name="layout">
-                  <tc:gridLayout rows="auto;1*;auto"/>
+  <tc:panel>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*;4*"/>
+    </f:facet>
+
+    <tc:link label="Link to Apache" link="http://www.apache.org/"/>
+    <tx:date label="Date">
+      <f:convertDateTime pattern="dd/MM/yyyy"/>
+    </tx:date>
+  </tc:panel>
+  <tc:selectOneChoice>
+    <tc:selectItem itemLabel="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" itemValue="A"/>
+    <tc:selectItem itemLabel="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" itemValue="B"/>
+    <tc:selectItem itemLabel="CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" itemValue="C"/>
+  </tc:selectOneChoice>
+  <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right" showDirectLinks="center">
+    <tc:column label="Column 1"/>
+    <tc:column label="Column 2"/>
+    <tc:column label="Column 3"/>
+  </tc:sheet>
+  <tc:panel>
+    <f:facet name="layout">
+      <tc:gridLayout columns="*;*"/>
+    </f:facet>
+  <tx:selectBooleanCheckbox label="1st Popup Modal" value="#{zIndex.modal1}" id="modal1st"/>
+  <tc:cell/>
+  <tx:selectBooleanCheckbox label="2nd Popup Modal" value="#{zIndex.modal2}"/>
+  <tc:cell/>
+  </tc:panel>
+  <tc:panel>
+    <f:facet name="layout">
+      <tc:gridLayout columns="auto;auto;auto;*"/>
+    </f:facet>
+    <tc:button label="Open Popup">
+      <f:facet name="popup">
+        <tc:popup width="600px" height="470px" left="100px" top="100px" id="popup-1" modal="#{zIndex.modal1}">
+          <tc:box label="Popup (z-index = 1 (TODO))" id="box-1">
+            <f:facet name="layout">
+              <tc:gridLayout rows="auto;auto;*;auto"/>
+            </f:facet>
+            <tx:date label="Date">
+              <f:convertDateTime pattern="dd/MM/yyyy"/>
+            </tx:date>
+            <tc:selectOneChoice>
+              <tc:selectItem itemLabel="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" itemValue="A"/>
+              <tc:selectItem itemLabel="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" itemValue="B"/>
+              <tc:selectItem itemLabel="CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" itemValue="C"/>
+            </tc:selectOneChoice>
+            <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right" showDirectLinks="center">
+              <tc:column label="Column 1"/>
+              <tc:column label="Column 2"/>
+              <tc:column label="Column 3"/>
+            </tc:sheet>
+            <tc:panel>
+              <f:facet name="layout">
+                <tc:gridLayout columns="*;*;*;*"/>
+              </f:facet>
+              <tc:button label="Open Sub Popup">
+                <f:facet name="popup">
+                  <tc:popup width="400px" height="500px" left="200px" top="50px" id="popup-2" modal="#{zIndex.modal2}">
+                    <tc:box label="Popup (z-index = 2 (TODO))" id="box-2">
+                      <f:facet name="layout">
+                        <tc:gridLayout rows="auto;auto;*;auto"/>
+                      </f:facet>
+                      <tx:date label="Date">
+                        <f:convertDateTime pattern="dd/MM/yyyy"/>
+                      </tx:date>
+                      <tc:selectOneChoice>
+                        <tc:selectItem itemLabel="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" itemValue="A"/>
+                        <tc:selectItem itemLabel="BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" itemValue="B"/>
+                        <tc:selectItem itemLabel="CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" itemValue="C"/>
+                      </tc:selectOneChoice>
+                      <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right"
+                                showDirectLinks="center">
+                        <tc:column label="Column 1"/>
+                        <tc:column label="Column 2"/>
+                        <tc:column label="Column 3"/>
+                      </tc:sheet>
+                      <tc:panel>
+                        <f:facet name="layout">
+                          <tc:gridLayout columns="*;*;*"/>
+                        </f:facet>
+                        <tc:button label="Cancel">
+                          <tc:attribute name="popupClose" value="immediate"/>
+                        </tc:button>
+                        <tc:button label="Redisplay">
+                          <tc:attribute name="renderedPartially" value="box-2"/>
+                        </tc:button>
+                        <tc:button label="Ok">
+                          <tc:attribute name="popupClose" value="afterSubmit"/>
+                        </tc:button>
+                      </tc:panel>
+                    </tc:box>
+                  </tc:popup>
                 </f:facet>
-                <tx:date label="Date">
-                  <f:convertDateTime pattern="dd/MM/yyyy"/>
-                </tx:date>
-                <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right" showDirectLinks="center">
-                  <tc:column label="Column 1"/>
-                  <tc:column label="Column 2"/>
-                  <tc:column label="Column 3"/>
-                </tc:sheet>
-                <tc:panel>
-                  <f:facet name="layout">
-                    <tc:gridLayout columns="*;*;*;*"/>
-                  </f:facet>
-                  <tc:button label="Open Sub Popup">
-                    <f:facet name="popup">
-                      <tc:popup width="400px" height="500px" left="200px" top="50px" id="popup-3">
-                        <tc:box label="Popup (z-index = 3 (TODO))" id="box-3">
-                          <f:facet name="layout">
-                            <tc:gridLayout rows="auto;1*;auto"/>
-                          </f:facet>
-                          <tx:date label="Date">
-                            <f:convertDateTime pattern="dd/MM/yyyy"/>
-                          </tx:date>
-                          <tc:sheet var="v1" columns="*;*;*" showRowRange="left" showPageRange="right"
-                                    showDirectLinks="center">
-                            <tc:column label="Column 1"/>
-                            <tc:column label="Column 2"/>
-                            <tc:column label="Column 3"/>
-                          </tc:sheet>
-                          <tc:panel>
-                            <f:facet name="layout">
-                              <tc:gridLayout columns="1*;1*;1*"/>
-                            </f:facet>
-                            <tc:button label="Cancel">
-                              <tc:attribute name="popupClose" value="immediate"/>
-                            </tc:button>
-                            <tc:button label="Redisplay">
-                              <tc:attribute name="renderedPartially" value="box-3"/>
-                            </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:button label="Cancel">
-                    <tc:attribute name="popupClose" value="immediate"/>
-                  </tc:button>
-                  <tc:button label="Redisplay">
-                    <tc:attribute name="renderedPartially" value="box-2"/>
-                  </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:panel>
-    </tc:box>
-  </tc:page>
+              </tc:button>
+              <tc:button label="Open Popup (AJAX)">
+                <tc:attribute name="renderedPartially" value="popup-2"/>
+                <tc:popupReference for="popup-2"/>
+              </tc:button>
+              <tc:button label="Cancel">
+                <tc:attribute name="popupClose" value="immediate"/>
+              </tc:button>
+              <tc:button label="Redisplay">
+                <tc:attribute name="renderedPartially" value="box-1"/>
+              </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:button label="Open Popup (AJAX)">
+      <tc:attribute name="renderedPartially" value="popup-1"/>
+      <tc:popupReference for="popup-1"/>
+    </tc:button>
+    <tc:button label="Update"/>
+  </tc:panel>
+</tc:box>
+</tc:page>
 </f:view>

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/DatePickerRenderer.java Fri Mar 26 15:21:39 2010
@@ -37,13 +37,11 @@ import org.apache.myfaces.tobago.compone
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.event.PopupActionListener;
-import org.apache.myfaces.tobago.internal.component.AbstractUIPopup;
 import org.apache.myfaces.tobago.internal.util.DateFormatUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
-import javax.faces.component.UICommand;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.Converter;
@@ -52,14 +50,10 @@ import java.io.IOException;
 import java.util.Map;
 import java.util.TimeZone;
 
-import static javax.faces.convert.DateTimeConverter.CONVERTER_ID;
-
 public class DatePickerRenderer extends LinkRenderer {
 
   private static final Log LOG = LogFactory.getLog(DatePickerRenderer.class);
 
-  public static final String CLOSE_POPUP = "closePopup";
-
   @Override
   public void onComponentCreated(FacesContext context, UIComponent component) {
     preparePicker(context, (UIDatePicker) component);
@@ -70,127 +64,109 @@ public class DatePickerRenderer extends 
       picker.setFor("@auto");
     }
     picker.setImmediate(true);
-    String linkId = picker.getId();
+    final String linkId = picker.getId();
+
+    final String hiddenId = linkId != null ? linkId + "hidden" : facesContext.getViewRoot().createUniqueId();
     UIHidden hidden = (UIHidden)
-        CreateComponentUtils.createComponent(facesContext, UIHidden.COMPONENT_TYPE, RendererTypes.HIDDEN);
-    if (linkId != null) {
-      hidden.setId(linkId + "hidden");
-    } else {
-      hidden.setId(facesContext.getViewRoot().createUniqueId());
-    }
+        CreateComponentUtils.createComponent(facesContext, UIHidden.COMPONENT_TYPE, RendererTypes.HIDDEN, hiddenId);
     picker.getChildren().add(hidden);
 
     // create popup
-    final AbstractUIPopup popup =
-        (AbstractUIPopup) CreateComponentUtils.createComponent(facesContext, UIPopup.COMPONENT_TYPE,
-            RendererTypes.POPUP);
-    if (linkId != null) {
-      popup.setId(linkId + "popup");
-    } else {
-      popup.setId(facesContext.getViewRoot().createUniqueId());
-    }
+    final String popupId = linkId != null ? linkId + "popup" : facesContext.getViewRoot().createUniqueId();
+    final UIPopup popup = (UIPopup) CreateComponentUtils.createComponent(
+        facesContext, UIPopup.COMPONENT_TYPE, RendererTypes.POPUP, popupId);
     popup.getAttributes().put(Attributes.Z_INDEX, 10);
-
     picker.getFacets().put(Facets.PICKER_POPUP, popup);
 
     popup.setRendered(false);
+    popup.onComponentPopulated(facesContext);
 
-    final UIComponent box = CreateComponentUtils.createComponent(
-        facesContext, UIBox.COMPONENT_TYPE, RendererTypes.BOX);
+    final UIBox box = (UIBox) CreateComponentUtils.createComponent(
+        facesContext, UIBox.COMPONENT_TYPE, RendererTypes.BOX, "box");
     popup.getChildren().add(box);
-    box.setId("box");
     // TODO: set string resources in renderer
-    box.getAttributes().put(Attributes.LABEL, ResourceManagerUtil.getPropertyNotNull(
-        facesContext, "tobago", "datePickerTitle"));
-    UIComponent layout = CreateComponentUtils.createComponent(
-        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT);
-    box.getFacets().put(Facets.LAYOUT, layout);
-    layout.setId("layout");
-    layout.getAttributes().put(Attributes.ROWS, "*;fixed;fixed");
+    box.setLabel(ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "datePickerTitle"));
+    final UIGridLayout layoutOfBox = (UIGridLayout) CreateComponentUtils.createComponent(
+        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT, "layout");
+    box.getFacets().put(Facets.LAYOUT, layoutOfBox);
+    layoutOfBox.setRows("*;fixed;fixed");
 
     final UIComponent calendar = CreateComponentUtils.createComponent(
-        facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE,
-        RendererTypes.CALENDAR);
-
-    calendar.setId("calendar");
+        facesContext, javax.faces.component.UIOutput.COMPONENT_TYPE, RendererTypes.CALENDAR, "calendar");
     box.getChildren().add(calendar);
 
     // add time input
-    final UIComponent timePanel = CreateComponentUtils.createComponent(
-        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL);
-    timePanel.setId("timePanel");
+    final UIPanel timePanel = (UIPanel) CreateComponentUtils.createComponent(
+        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL, "timePanel");
     box.getChildren().add(timePanel);
-    layout = CreateComponentUtils.createComponent(
-        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT);
-    timePanel.getFacets().put(Facets.LAYOUT, layout);
-    layout.setId("timePanelLayout");
-    layout.getAttributes().put(Attributes.COLUMNS, "1*;fixed;1*");
-    UIComponent cell = CreateComponentUtils.createComponent(
-        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL);
-    cell.setId("cell1");
-    timePanel.getChildren().add(cell);
-
-    final UIComponent time = CreateComponentUtils.createComponent(
-        facesContext,
-        UITime.COMPONENT_TYPE,
-        RendererTypes.TIME);
+    final UIGridLayout layoutOfTime = (UIGridLayout) CreateComponentUtils.createComponent(
+        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT, "timePanelLayout");
+    timePanel.getFacets().put(Facets.LAYOUT, layoutOfTime);
+    layoutOfTime.setColumns("1*;fixed;1*");
+    final UIPanel cell1 = (UIPanel) CreateComponentUtils.createComponent(
+        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL, "cell1");
+    cell1.onComponentPopulated(facesContext);
+    timePanel.getChildren().add(cell1);
+
+    final UITime time = (UITime) CreateComponentUtils.createComponent(
+        facesContext, UITime.COMPONENT_TYPE, RendererTypes.TIME, "time");
     timePanel.getChildren().add(time);
-    time.setId("time");
 
-    cell = CreateComponentUtils.createComponent(
-        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL);
-    cell.setId("cell2");
-    timePanel.getChildren().add(cell);
-
-
-    UIComponent buttonPanel = CreateComponentUtils.createComponent(
-        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL);
-    buttonPanel.setId("buttonPanel");
-    layout = CreateComponentUtils.createComponent(
-        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT);
-    layout.setId("buttonPanelLayout");
-    buttonPanel.getFacets().put(Facets.LAYOUT, layout);
-    layout.getAttributes().put(Attributes.COLUMNS, "*;*");
-    layout.getAttributes().put(Attributes.ROWS, "fixed");
+    final UIPanel cell2 = (UIPanel) CreateComponentUtils.createComponent(
+        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL, "cell2");
+    cell2.onComponentPopulated(facesContext);
+    timePanel.getChildren().add(cell2);
+
+    timePanel.onComponentPopulated(facesContext);
+
+
+    final UIPanel buttonPanel = (UIPanel) CreateComponentUtils.createComponent(
+        facesContext, UIPanel.COMPONENT_TYPE, RendererTypes.PANEL, "buttonPanel");
+    final UIGridLayout layoutOfButtons = (UIGridLayout) CreateComponentUtils.createComponent(
+        facesContext, UIGridLayout.COMPONENT_TYPE, RendererTypes.GRID_LAYOUT, "buttonPanelLayout");
+    buttonPanel.setLayoutManager(layoutOfButtons);
+    layoutOfButtons.setColumns("*;*");
+    layoutOfButtons.setRows("fixed");
 
     box.getChildren().add(buttonPanel);
+    box.onComponentPopulated(facesContext);
 
-    final UIButton okButton = (UIButton)
-        CreateComponentUtils.createComponent(facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON);
+    final UIButton okButton = (UIButton) CreateComponentUtils.createComponent(
+        facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON, "ok");
     buttonPanel.getChildren().add(okButton);
-    okButton.setId("ok" + CLOSE_POPUP);
-    okButton.getAttributes().put(Attributes.LABEL, ResourceManagerUtil.getPropertyNotNull(
-        facesContext, "tobago", "datePickerOk"));
+    okButton.setLabel(ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "datePickerOk"));
+    okButton.setOnclick("writeIntoField2(this);");
+    okButton.getAttributes().put(Attributes.POPUP_CLOSE, "afterSubmit");
 
-    final UIButton cancelButton = (UIButton)
-        CreateComponentUtils.createComponent(facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON);
+    final UIButton cancelButton = (UIButton) CreateComponentUtils.createComponent(
+        facesContext, UIButton.COMPONENT_TYPE, RendererTypes.BUTTON, "cancel");
     buttonPanel.getChildren().add(cancelButton);
+    cancelButton.setLabel(ResourceManagerUtil.getPropertyNotNull(facesContext, "tobago", "datePickerCancel"));
+    cancelButton.setOnclick( "writeIntoField2(this);");
+    cancelButton.getAttributes().put(Attributes.POPUP_CLOSE, "immediate");
 
-    cancelButton.getAttributes().put(Attributes.LABEL, ResourceManagerUtil.getPropertyNotNull(
-        facesContext, "tobago", "datePickerCancel"));
-    cancelButton.setId(CLOSE_POPUP);
+    buttonPanel.onComponentPopulated(facesContext);
 
     // create image
-    UIImage image = (UIImage)
-        CreateComponentUtils.createComponent(facesContext, UIImage.COMPONENT_TYPE, RendererTypes.IMAGE);
+    // check the id: its might be better not calling createUniqueId
+    final String imageId = linkId != null ? linkId + "image" : facesContext.getViewRoot().createUniqueId();
+    final UIImage image = (UIImage) CreateComponentUtils.createComponent(
+        facesContext, UIImage.COMPONENT_TYPE, RendererTypes.IMAGE, imageId);
     image.setRendered(true);
-    if (linkId != null) {
-      image.setId(linkId + "image");
-    } else {
-      image.setId(facesContext.getViewRoot().createUniqueId());
-    }
     image.setValue("image/date.gif");
-    image.getAttributes().put(Attributes.ALT, ""); //TODO: i18n
+    image.setAlt(""); //TODO: i18n (write a text)
     StyleClasses.ensureStyleClasses(image).addFullQualifiedClass("tobago-input-picker"); // XXX not a standard name
     picker.getChildren().add(image);
   }
 
 
+  @Override
   public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
     UIDatePicker picker = (UIDatePicker) component;
     // todo: use Measure instead of int
+    // todo: call setWidth ???
     picker.getAttributes().put(
-        Attributes.LAYOUT_WIDTH, 
+        Attributes.LAYOUT_WIDTH,
         getResourceManager().getThemeMeasure(facesContext, picker, "pickerWidth").getPixel());
     if (facesContext instanceof TobagoFacesContext) {
       UIPopup popup = (UIPopup) picker.getFacets().get(Facets.PICKER_POPUP);
@@ -203,6 +179,7 @@ public class DatePickerRenderer extends 
     super.prepareRender(facesContext, picker);
   }
 
+  @Override
   public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {
     UIDatePicker picker = (UIDatePicker) component;
 //    DatePickerController datePickerController = new DatePickerController();
@@ -242,16 +219,6 @@ public class DatePickerRenderer extends 
       //    + converterPattern);
     }
 
-    UICommand okButton = (UICommand) popup.findComponent("ok" + CLOSE_POPUP);
-    attributes = okButton.getAttributes();
-    attributes.put(Attributes.ONCLICK, "writeIntoField2(this);");
-    attributes.put(Attributes.POPUP_CLOSE, "afterSubmit");
-
-    UICommand cancelButton = (UICommand) popup.findComponent(CLOSE_POPUP);
-    attributes = cancelButton.getAttributes();
-    attributes.put(Attributes.ONCLICK, "writeIntoField2(this);");
-    attributes.put(Attributes.POPUP_CLOSE, "immediate");
-
     applyConverterPattern(facesContext, popup, converterPattern);
 
     if (!ComponentUtils.containsPopupActionListener(picker)) {
@@ -269,7 +236,7 @@ public class DatePickerRenderer extends 
       popupHeight = popupHeight.add(getResourceManager().getThemeMeasure(facesContext, time, "preferredHeight"));
       popup.setHeight(popupHeight);
       DateTimeConverter dateTimeConverter
-          = (DateTimeConverter) facesContext.getApplication().createConverter(CONVERTER_ID);
+          = (DateTimeConverter) facesContext.getApplication().createConverter(DateTimeConverter.CONVERTER_ID);
       if (converterPattern.indexOf('s') > -1) {
         dateTimeConverter.setPattern("HH:mm:ss");
       } else {
@@ -282,6 +249,7 @@ public class DatePickerRenderer extends 
     }
   }
 
+  @Override
   public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
     UIDatePicker link = (UIDatePicker) component;
     UIDate dateInput = (UIDate) link.getForComponent();

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=927912&r1=927911&r2=927912&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 Fri Mar 26 15:21:39 2010
@@ -19,23 +19,19 @@ package org.apache.myfaces.tobago.render
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.component.UIPopup;
-import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.context.TobagoFacesContext;
 import org.apache.myfaces.tobago.internal.ajax.AjaxInternalUtils;
 import org.apache.myfaces.tobago.internal.ajax.AjaxRenderer;
+import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
 import org.apache.myfaces.tobago.internal.layout.LayoutContext;
-import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
-import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.css.Style;
 import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.StyleClasses;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtil;
 import org.apache.myfaces.tobago.util.ComponentUtils;
-import org.apache.myfaces.tobago.util.VariableResolverUtils;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
@@ -57,6 +53,11 @@ public class PopupRenderer extends Layou
     if (facesContext instanceof TobagoFacesContext) {
       ((TobagoFacesContext) facesContext).getPopups().add((UIPopup) component);
     }
+
+    // TODO: where to put this code, it is good here?
+    TobagoFacesContext tobagoContext = (TobagoFacesContext) facesContext;
+    tobagoContext.getScriptBlocks().add("jQuery(document).ready(function() {Tobago.setupPopup();});");
+
     super.prepareRender(facesContext, component);
   }
 
@@ -68,6 +69,7 @@ public class PopupRenderer extends Layou
 
 // LAYOUT Begin
 
+    // todo: remove time logging
     long begin = System.nanoTime();
     LayoutContext layoutContext = new LayoutContext(popup);
     layoutContext.layout();
@@ -76,111 +78,45 @@ public class PopupRenderer extends Layou
 // LAYOUT End
 
     final String clientId = popup.getClientId(facesContext);
-    final String contentDivId = clientId + ComponentUtils.SUB_SEPARATOR + "content";
-    //final String left = popup.getLeft();
-    //final String top = popup.getTop();
-    Integer zIndex = (Integer) popup.getAttributes().get(Attributes.Z_INDEX);
-    if (zIndex == null) {
-      zIndex = 0;
-    }
 
-    final StringBuilder contentStyle = new StringBuilder(32);
-    if (popup.getCurrentWidth() != null) {
-      contentStyle.append("width: ");
-      contentStyle.append(popup.getCurrentWidth().getPixel());
-      contentStyle.append("; ");
-    }
-    if (popup.getCurrentHeight() != null) {
-      contentStyle.append("height: ");
-      contentStyle.append(popup.getCurrentHeight().getPixel());
-      contentStyle.append("; ");
+    // XXX May be computed in the "Layout Manager Phase"
+    AbstractUIPage page = ComponentUtils.findPage(facesContext);
+    if (popup.getLeft() == null) {
+      popup.setLeft(page.getWidth().subtract(popup.getWidth()).divide(2));
     }
-    contentStyle.append("z-index: ");
-    contentStyle.append(zIndex + 3);
-    contentStyle.append("; ");
-    //contentStyle.append("left: ");
-    //contentStyle.append(left);
-    //contentStyle.append("; ");
-    //contentStyle.append("top: ");
-    //contentStyle.append(top);
-    //contentStyle.append("; ");
-    if (popup.isModal()) {
-      writer.startElement(HtmlConstants.DIV, popup);
-      writer.writeIdAttribute(clientId);
-      writer.writeStyleAttribute("z-index: " + (zIndex + 1) + ";");
-      writer.writeClassAttribute();
-      writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.popupBlink('" + clientId + "')", null);
-      if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie()) {
-        String bgImage = ResourceManagerUtil.getImageWithPath(facesContext, "image/popupBg.png");
-        writer.writeAttribute(HtmlAttributes.STYLE, "background: none; "
-            + "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
-          + bgImage + "', sizingMethod='scale');", false);
-      }
-      writer.endElement(HtmlConstants.DIV);
-    }
-    if (VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().isMsie()) {
-      writer.startElement(HtmlConstants.IFRAME, popup);
-      writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + HtmlConstants.IFRAME);
-      writer.writeClassAttribute("tobago-popup-iframe tobago-popup-none");
-      writer.writeStyleAttribute("z-index: " + (zIndex + 2) + ";");
-      UIPage page = (UIPage) ComponentUtils.findPage(facesContext);
-      if (popup.isModal()) {
-        final StringBuilder frameSize = new StringBuilder(32);
-        // full client area
-        frameSize.append("width: ");
-        frameSize.append(page.getCurrentWidth().getPixel());
-        frameSize.append("; ");
-        frameSize.append("height: ");
-        frameSize.append(page.getCurrentHeight().getPixel());
-        frameSize.append("; ");
-        writer.writeAttribute(HtmlAttributes.STYLE, frameSize.toString(), false);
-      } else {
-        writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), false); // size of the popup
-      }
-
-      writer.writeAttribute(HtmlAttributes.SRC, ResourceManagerUtil.getBlankPage(facesContext), false);
-      writer.writeAttribute(HtmlAttributes.FRAMEBORDER, "0", false);
-      writer.endElement(HtmlConstants.IFRAME);
+    if (popup.getTop() == null) {
+      popup.setTop(page.getHeight().subtract(popup.getWidth()).divide(2));
     }
+
     writer.startElement(HtmlConstants.DIV, popup);
-    writer.writeIdAttribute(contentDivId);
-    StyleClasses styleClasses = new StyleClasses();
-    styleClasses.addClass("popup", "content");
-    styleClasses.addClass("popup", "none");
+    writer.writeIdAttribute(clientId);
+    Style style = new Style(facesContext, popup);
+    Integer zIndex = popup.getZIndex();
+    if (zIndex == null) {
+      zIndex = 100;
+      LOG.warn("No z-index found for UIPopup. Set to " + zIndex);
+    }
+    style.setZIndex(zIndex);
+    writer.writeStyleAttribute(style);
+    StyleClasses styleClasses = StyleClasses.ensureStyleClasses(popup);
     if (popup.isModal()) {
       styleClasses.addClass("popup", "modal");
     }
     writer.writeClassAttribute(styleClasses);
-
-    writer.writeAttribute(HtmlAttributes.STYLE, contentStyle.toString(), false);
   }
 
   @Override
   public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException {
     TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
-    UIPopup popup = (UIPopup) component;
-    final String clientId = popup.getClientId(facesContext);
-
     writer.endElement(HtmlConstants.DIV);
-
-    writer.startJavascript();
-    writer.write("Tobago.setupPopup('");
-    writer.write(clientId);
-    writer.write("', ");
-    final Measure left = popup.getLeft();
-    writer.write(left != null ? Integer.toString(left.getPixel()) : "null");
-    writer.write(", ");
-    final Measure top = popup.getTop();
-    writer.write(top != null ? Integer.toString(top.getPixel()) : "null");
-    writer.write(", ");
-    writer.write(String.valueOf(popup.isModal()));
-    writer.write(");");
-    writer.endJavascript();
   }
 
   public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
     AjaxInternalUtils.checkParamValidity(facesContext, component, UIPopup.class);
     RenderUtil.encode(facesContext, component);
+    TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
+    writer.startJavascript();
+    writer.write("Tobago.setupPopup();");
+    writer.endJavascript();
   }
 }
-

Modified: myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/tobago-menu.js Fri Mar 26 15:21:39 2010
@@ -214,6 +214,10 @@ function xxx_tobagoMenuInit() {
     // a click on the top menu make the complete menu active or inactive respectively.
     jQuery(".tobago-menu-top").click(function(event) {
 
+      // e. g. disabled by a popup
+      if($(this).children("a").attr("disabled")) {
+        return;
+      }
       // register on click handlers
       var menuBar = jQuery(this).parent();
       var wasActive = 'true' == menuBar.attr('menu-active'); // read state

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=927912&r1=927911&r2=927912&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 Fri Mar 26 15:21:39 2010
@@ -561,21 +561,22 @@ label.tobago-label-inline {
   left: 0;
   overflow: auto;
   position: absolute;
+  z-index: 0;
 }
 
-/* popup-------------------------------------------------------------- */
+/* popup -------------------------------------------------------------- */
 
-.tobago-popup-default {
+.tobago-popup-shield {
   cursor: wait;
   width: 100%;
   height: 100%;
-  position: absolute;
+  position: fixed;
   top: 0;
-  left: 0; /*background: url(../../standard/image/popupBg.png);*/
+  left: 0;
+  z-index: -1;
   opacity: .40;
   background: url( ../image/popupBg.png );
   filter: alpha( opacity = 40 );
-  -moz-opacity: 0.4;
 }
 
 .tobago-popup-blink {
@@ -591,28 +592,6 @@ label.tobago-label-inline {
   filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);
 }
 
-.tobago-popup-content {
-  border-width: 0;
-  background: #bbccdd;
-  position: absolute;
-  cursor: default;
-  box-sizing: border-box;
-  -moz-box-sizing: border-box;
-  -moz-background-clip: initial;
-  -moz-background-origin: initial;
-  -moz-background-inline-policy: initial;
-}
-
-.tobago-popup-none {
-  display: none;
-}
-
-.tobago-popup-parent {
-  position: absolute;
-  top: 0;
-  left: 0;
-}
-
 /* richTextEditor ---------------------------------------------------------- */
 
 .tobago-richTextEditor-default {
@@ -1101,7 +1080,6 @@ li.tobago-menu-selected {
   position: absolute;
   width: 100%;
   background-color: #aabbcc;
-/*  z-index: 1000; /* todo */
 }
 
 .tobago-page-menuStore {
@@ -1110,7 +1088,7 @@ li.tobago-menu-selected {
   width: 0;
   height: 0;
   position: absolute;
-/*  z-index: 1000; /* todo */
+  z-index: 1000;
 }
 
 .tobago-menuBar-default ol, 

Modified: myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css?rev=927912&r1=927911&r2=927912&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css (original)
+++ myfaces/tobago/trunk/theme/speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/style/style.css Fri Mar 26 15:21:39 2010
@@ -53,7 +53,7 @@ table {
 }
 
 /*-- Popup ------------------------------------------------------------------ */
-.tobago-popup-content  {
+.tobago-popup-default  {
   background: #E2E2E2;
 }
 

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=927912&r1=927911&r2=927912&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 Fri Mar 26 15:21:39 2010
@@ -231,17 +231,6 @@ var Tobago = {
 
   isSubmit: false,
 
-
-  /**
-    * The id of a initially loaded popup (not by ajax)
-    */
-  initialPopupId: null,
-
-  /**
-    * Count of currently open popups
-    */
-  openPopups: new Array(),
-
   initMarker: false,
 
   // -------- Functions -------------------------------------------------------
@@ -306,11 +295,7 @@ var Tobago = {
       TbgTimer.endScriptLoaders = new Date();
     }
     Tobago.pageIsComplete = true;
-    if (Tobago.initialPopupId != null) {
-      Tobago.lockPopupPage(Tobago.initialPopupId);
-    } else {
-      Tobago.setFocus();
-    }
+    Tobago.setFocus();
     if (TbgTimer.endBody) {
       TbgTimer.endTotal = new Date();
       TbgTimer.log();
@@ -523,14 +508,7 @@ var Tobago = {
 
     Tobago.setActionPosition(source);
 
-    if (Tobago.openPopups.length > 0 ) {
-      // enable all elements on page when this is a submit from a popup
-      // (disabled input elements are not submitted)
-      for (i = 0; i < document.forms[0].elements.length; i++) {
-        var element = document.forms[0].elements[i];
-        element.disabled = false;
-      }
-    }
+    Tobago.unlockBehindPopup();
 
     Tobago.Transport.request(function() {
       if (!this.isSubmit) {
@@ -935,101 +913,80 @@ var Tobago = {
     // TODO move popup functions into Tobago.Popup object
 
   /**
-    * Setup popup size
-   *  @param id String
-   *  @param left int or null
-   *  @param top int or null
-   *  @param modal boolean or null
-    */
-  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") {
-      hidden.parentNode.removeChild(hidden);
-    }
-
-    // extend background into scrollable area
-    var background = this.element(id);
-    if (background) {
-      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);
-    }
-    
-    var contentId = id + Tobago.SUB_COMPONENT_SEP + "content";
-    var div = jQuery(Tobago.escapeClientId(contentId));
-    if (div) {
+   * Setup popup size
+   */
+  setupPopup: function() {
 
-      // XXX removing the class would be better after setting the position, but
-      // XXX div.children().outerWidth() doesn't work in that case (which is used in the next lines).
-      div.removeClass("tobago-popup-none");
-      
-      // calculate left, if lack
-      if (left == null) {
-        left = (jQuery(window).width() - div.children().outerWidth()) / 2;
-      }
-  
-      // calculate top, if lack
-      if (top == null) {
-        top = (jQuery(window).height() - div.children().outerHeight()) / 2;
-      }
+    // TODO: remove later (after change AJAX, that they replace tags instead of fill them...)
+    jQuery(".tobago-popup-parent > .tobago-popup-default").unwrap();
 
-//      alert("Setting offset of popup: left to '" + left + "' and top to '" + top + "'");
-      div.offset({ left: left, top: top });
-      
-      // iframe is used in IE, because the <select> tags would shining through.
-      var iframeId = id + Tobago.SUB_COMPONENT_SEP + "iframe";
-      var iframe = jQuery(Tobago.escapeClientId(iframeId));
-      if (iframe) {
-        if (!modal) {
-          iframe.offset({ left: left, top: top });
-        }
-        iframe.removeClass("tobago-popup-none");
-      }
-    }
+    // The shield is a protection against clicking controls, which are not allowed to click in the modal case.
+    // The shield also makes an optical effect (alpha blending).
 
-    if (!Tobago.pageIsComplete) {
-      // Popup is loaded during page loading
-      Tobago.initialPopupId = id;
-    } else {
-      var contains = false;
-      for(var i = 0; i < Tobago.openPopups.length; i++) {
-        if (Tobago.openPopups[i] == id) {
-          contains = true;
-        }
-      }
-      if (!contains && modal) {
-        // Popup is loaded by ajax
-        Tobago.lockPopupPage(id);
+    // remove all old shields
+    jQuery(".tobago-popup-shield").remove();
+
+    // find highest modal popup
+    var maxZIndex = -Infinity;
+    var maxModalPopup = null;
+    jQuery(".tobago-popup-modal").each(function() {
+      var zIndex = jQuery(this).css("z-index");
+      if (zIndex >= maxZIndex) {
+        maxZIndex = zIndex;
+        maxModalPopup = jQuery(this);
+      }
+    });
+
+    // add the new shield to the highest modal popup
+    if (maxModalPopup != null && maxModalPopup.size() > 0) { // same as == 1
+
+      maxModalPopup.prepend("<div class='tobago-popup-shield' onclick='Tobago.popupBlink(this)'/>");
+      var shield = maxModalPopup.children(".tobago-popup-shield");
+      shield.attr("id", maxModalPopup.attr("id") + "::shield");
+
+      // IE6 doesn't support position:fixed
+      if (jQuery.browser.msie && parseInt(jQuery.browser.version) <= 6) {
+        shield.css({
+          position: "absolute",
+          left: -maxModalPopup.offset().left,
+          top: -maxModalPopup.offset().top,
+          width: jQuery(window).width(),
+          height: jQuery(window).height(),
+          background: "none",
+          filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"
+              + Tobago.OVERLAY_BACKGROUND + "', sizingMethod='scale');"
+        });
+
+        // IE6 needs an iframe to protect the other controls and protect against select-tag shining through.
+        maxModalPopup.prepend("<iframe class='tobago-popup-iframe'/>");
+        var iframe = maxModalPopup.children(".tobago-popup-iframe");
+        iframe.css({
+          position: "absolute",
+          left: -maxModalPopup.offset().left,
+          top: -maxModalPopup.offset().top,
+          width: jQuery(window).width(),
+          height: jQuery(window).height()
+        })
       }
-    }
-    var contains = false;
-    for(var i = 0; i < Tobago.openPopups.length; i++) {
-      if (Tobago.openPopups[i] == id) {
-        contains = true;
-      }
-    }
-    if (!contains&& modal) {
-      Tobago.openPopups.push(id);
-    }
 
-    //LOG.info("OpenPopupCount " + Tobago.openPopups);
+      // disable the page and all popups behind the highest modal popup
+      Tobago.lockBehindPopup(maxModalPopup.get(0));
+    }
   },
 
   /**
     * Locks the parent page of a popup when it is opened
     */
-  lockPopupPage: function(id) {
+  lockBehindPopup: function(popup) {
     // disable all elements and anchors on page not initially disabled and
     // store their ids in a hidden field
+    var id = popup.id;
     var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
     if (hidden == null) {
       hidden = document.createElement("input");
       hidden.id = id + Tobago.SUB_COMPONENT_SEP + "disabledElements";
-      hidden.name = id;
       hidden.type = "hidden";
-      document.forms[0].appendChild(hidden);
+      popup.appendChild(hidden);
     }
     hidden.value = ",";
     var firstPopupElement = null;
@@ -1037,7 +994,7 @@ var Tobago = {
       var element = document.forms[0].elements[i];
       if (element.type != "hidden" && !element.disabled) {
         if (element.id) {
-          if (element.id.indexOf(id + ":") != 0) {
+          if (element.id.indexOf(id + ":") != 0) { // not starts with
             element.disabled = true;
             hidden.value += element.id + ",";
           } else {
@@ -1048,11 +1005,12 @@ var Tobago = {
         }
       }
     }
-    for (i = 0; i < document.anchors.length; i++) {
-      var element = document.anchors[i];
+    var anchors = document.getElementsByTagName('a');
+    for (i = 0; i < anchors.length; i++) {
+      var element = anchors[i];
       if (!element.disabled) {
         if (element.id) {
-          if (element.id.indexOf(id + ":") != 0) {
+          if (element.id.indexOf(id + ":") != 0) { // not starts with
              element.disabled = true;
              hidden.value += element.id + ",";
           } else {
@@ -1071,100 +1029,48 @@ var Tobago = {
     }
   },
 
-  popupResizeStub: null,
-
-  doResizePopupBackground: function(id) {
-    var background = Tobago.element(id);
-    if (background) {
-      background.style.width = Math.max(document.body.scrollWidth, document.body.clientWidth) + 'px';
-      background.style.height = Math.max(document.body.scrollHeight, document.body.clientHeight) + 'px';
-    }
-  },
-
   /**
    * Make popup blink
    */
-  popupBlink: function(id) {
-    LOG.debug("popupId ist " + id);
+  popupBlink: function(element) {
+    var id = jQuery(element).attr("id");
+    LOG.debug("Blink: Popup id is '" + id + "'");
     Tobago.addCssClass(id, "tobago-popup-blink");
-    setTimeout("Tobago.removeCssClass('" + id + "', 'tobago-popup-blink')", 10);
+    setTimeout("Tobago.removeCssClass('" + id + "', 'tobago-popup-blink')", 30);
   },
 
   /**
    * remove a popup without request
    */
   closePopup: function(element) {
-    var div;
-    var id;
-    if (typeof element == "string") {
-      id = element;
-    } else if (typeof element == "object" && element.tagName) {
-      div = Tobago.findAnchestorWithTagName(element, "DIV");
-      while (div && div.className && div.className.indexOf("tobago-popup-content") == -1) {
-        div = Tobago.findAnchestorWithTagName(div.parentNode, "DIV");
-      }
-      if (div) {
-        var re = new RegExp(Tobago.SUB_COMPONENT_SEP + "content$");
-        id = div.id.replace(re, "");
-      }
-    }
-
-    div = Tobago.element(id + "parentDiv");
-    if (div) {
-      // created by ajax
-      div.parentNode.removeChild(div);
-    } else if (id) {
-      div = Tobago.element(id);
-      if (div) {
-        div.parentNode.removeChild(div);
-      }
-      div = Tobago.element(id + this.SUB_COMPONENT_SEP + "content");
-      if (div) {
-        div.parentNode.removeChild(div);
-      }
-      div = Tobago.element(id + this.SUB_COMPONENT_SEP + "iframe");
-      if (div) {
-        div.parentNode.removeChild(div);
-      }
-    } else {
-      LOG.error("Cannot close popup ");
-    }
-
-    var hidden = document.createElement("input");
-    hidden.id = id + Tobago.SUB_COMPONENT_SEP + "hidden";
-    hidden.name = id;
-    hidden.type = "hidden";
-    hidden.value = "closed";
-    Tobago.form.appendChild(hidden);
-
-    Tobago.removeEventListener(window, "resize", Tobago.popupResizeStub);
-    Tobago.popupResizeStub = null;
-    //LOG.info("unlockPopupPage " + id);
-    Tobago.unlockPopupPage(id);
-    Tobago.openPopups.pop();
-    //LOG.info("OpenPopupCount " + Tobago.openPopups);
-
-    // reset focus when last popup was closed
-    if (Tobago.openPopups.length == 0) {
-      Tobago.setFocus();
-    }
+    Tobago.unlockBehindPopup();
+    var popup = $(element).parents("div.tobago-popup-default:first");
+    popup.remove();
+    Tobago.setupPopup();
   },
 
   /**
     * Unlock the parent page of a popup when it is closed
     */
-  unlockPopupPage: function(id) {
+  unlockBehindPopup: function() {
+    var maxModalPopup = jQuery(".tobago-popup-shield").parent();
+    if (maxModalPopup.size() == 0) { // there is no modal popup
+      return;
+    }
+    var id = maxModalPopup.attr("id");
     // enable all elements and anchors on page stored in a hidden field
+    var element;
     var hidden = Tobago.element(id + Tobago.SUB_COMPONENT_SEP + "disabledElements");
     if (hidden != null && hidden.value != "") {
      for (var i = 0; i < document.forms[0].elements.length; i++) {
-       var element = document.forms[0].elements[i];
+       element = document.forms[0].elements[i];
        if (hidden.value.indexOf("," + element.id + ",") >= 0) {
          element.disabled = false;
        }
      }
-     for (i = 0; i < document.anchors.length; i++) {
-       var element = document.anchors[i];
+     var anchors = document.getElementsByTagName('a');
+     for (i = 0; i < anchors.length; i++) {
+       element = anchors[i];
        if (hidden.value.indexOf("," + element.id + ",") >= 0) {
          element.disabled = false;
        }
@@ -1192,10 +1098,6 @@ var Tobago = {
     }
 
     Tobago.addAjaxComponent(popupId, div.id);
-    var newOptions = {createOverlay: false}
-    if (options) {
-      Tobago.extend(newOptions, options);
-    }
     Tobago.reloadComponent(source, popupId, actionId, options);
   },
 
@@ -1745,7 +1647,7 @@ var Tobago = {
       if (typeof arg == 'string') {
 //        LOG.debug("arg is string ");
         return document.getElementById(arg);
-      } else if (typeof arg.currentTarget == 'object') {
+      } else if (typeof arg.currentjTarget == 'object') {
 //        LOG.debug("arg is DOM event ");
         return arg.currentTarget;
       } else if (typeof arg.srcElement == 'object') {
@@ -2454,6 +2356,7 @@ Tobago.Updater = {
     if (data.responseCode == Tobago.Updater.CODE_SUCCESS) {
       var container = Tobago.ajaxComponents[data.ajaxId];
       if (container) {
+// TODO: replace the object instead of replace the content, but for that we have to change the renderers.
         container = Tobago.element(container);
         container.innerHTML = data.html;
         try {
@@ -2512,8 +2415,6 @@ Tobago.Updater = {
       }
 
       Tobago.Updater.handleMissingResponses(requestOptions.ajaxComponentIds, doneIds);
-
-
     },
 
     handleMissingResponses: function(ids, doneIds) {



Mime
View raw message