You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/10/31 11:09:47 UTC

svn commit: r469435 - in /myfaces/tobago/trunk: core/src/main/java/org/apache/myfaces/tobago/ core/src/main/java/org/apache/myfaces/tobago/component/ core/src/main/java/org/apache/myfaces/tobago/renderkit/html/ core/src/main/java/org/apache/myfaces/tob...

Author: weber
Date: Tue Oct 31 02:09:46 2006
New Revision: 469435

URL: http://svn.apache.org/viewvc?view=rev&rev=469435
Log:
working on TOBAGO-167 (Enable rendering popups by ajax request)

Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.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/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/TobagoConstants.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/TobagoConstants.java Tue Oct 31 02:09:46 2006
@@ -102,6 +102,7 @@
   public static final String ATTR_PREFORMATED = "preformated";
   public static final String ATTR_READONLY = "readonly";
   public static final String ATTR_REFERENCE = "reference";
+  public static final String ATTR_RENDERED = "rendered";
   public static final String ATTR_RENDERER_TYPE = "rendererType";
   public static final String ATTR_RENDER_AS = "renderAs";
   public static final String ATTR_RENDER_RANGE = "renderRange";

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/component/UIPopup.java Tue Oct 31 02:09:46 2006
@@ -18,12 +18,16 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_RENDERED;
+import org.apache.myfaces.tobago.ajax.api.AjaxComponent;
 
 import javax.faces.component.NamingContainer;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
+import javax.faces.el.ValueBinding;
+import java.io.IOException;
 
-public class UIPopup extends UIPanel implements NamingContainer {
+public class UIPopup extends UIPanel implements NamingContainer, AjaxComponent {
 
   private static final Log LOG = LogFactory.getLog(UIPopup.class);
 
@@ -32,6 +36,8 @@
   private String left;
   private String top;
 
+  private boolean popupReset;
+
   public static final String COMPONENT_TYPE = "org.apache.myfaces.tobago.Popup";
 
   public void processDecodes(FacesContext facesContext) {
@@ -40,6 +46,29 @@
     addToPage();
   }
 
+
+  public void encodeEnd(FacesContext context) throws IOException {
+    super.encodeEnd(context);
+    checkReset(context);
+  }
+
+
+  public void encodeAjax(FacesContext facesContext) throws IOException {
+    super.encodeAjax(facesContext);
+    checkReset(facesContext);
+  }
+
+  private void checkReset(FacesContext facesContext) {
+    if (popupReset) {
+      ValueBinding reset = getValueBinding(ATTR_RENDERED);
+      if (reset != null) {
+        reset.setValue(facesContext, false);
+      } else {
+        setRendered(false);
+      }
+    }
+  }
+
   public void setParent(UIComponent uiComponent) {
     super.setParent(uiComponent);
     // XXX find a better way
@@ -47,12 +76,13 @@
   }
 
   public Object saveState(FacesContext context) {
-    Object[] saveState = new Object[5];
+    Object[] saveState = new Object[6];
     saveState[0] = super.saveState(context);
     saveState[1] = width;
     saveState[2] = height;
     saveState[3] = left;
     saveState[4] = top;
+    saveState[5] = popupReset;
     return saveState;
   }
 
@@ -63,6 +93,7 @@
     height = (String) values[2];
     left = (String) values[3];
     top = (String) values[4];
+    popupReset = (Boolean) values[5];
   }
 
   public String getWidth() {
@@ -95,6 +126,15 @@
 
   public void setTop(String top) {
     this.top = top;
+  }
+
+
+  public boolean isPopupReset() {
+    return popupReset;
+  }
+
+  public void setPopupReset(boolean popupReset) {
+    this.popupReset = popupReset;
   }
 
   private void addToPage() {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/renderkit/html/HtmlRendererUtil.java Tue Oct 31 02:09:46 2006
@@ -19,6 +19,7 @@
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.myfaces.tobago.TobagoConstants;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_DISABLED;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_FOCUS;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_INLINE;
@@ -41,18 +42,17 @@
 import static org.apache.myfaces.tobago.TobagoConstants.TOBAGO_CSS_CLASS_SUFFIX_INLINE;
 import static org.apache.myfaces.tobago.TobagoConstants.TOBAGO_CSS_CLASS_SUFFIX_READONLY;
 import org.apache.myfaces.tobago.component.ComponentUtil;
-import org.apache.myfaces.tobago.component.UIPage;
 import org.apache.myfaces.tobago.component.SupportsMarkup;
-import org.apache.myfaces.tobago.context.ResourceManagerUtil;
+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.context.Theme;
+import org.apache.myfaces.tobago.renderkit.HtmlUtils;
 import org.apache.myfaces.tobago.renderkit.LabelWithAccessKey;
-import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.renderkit.RenderUtil;
-import org.apache.myfaces.tobago.renderkit.HtmlUtils;
+import org.apache.myfaces.tobago.renderkit.RendererBase;
 import org.apache.myfaces.tobago.util.LayoutUtil;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
-import org.apache.myfaces.tobago.TobagoConstants;
 
 import javax.faces.component.UIComponent;
 import javax.faces.component.UIInput;
@@ -62,10 +62,10 @@
 import javax.faces.model.SelectItem;
 import javax.faces.model.SelectItemGroup;
 import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.List;
-import java.util.Arrays;
 
 /*
  * User: weber
@@ -610,6 +610,9 @@
     //  onclick = null;
     } else if (component.getAttributes().get(TobagoConstants.ATTR_ACTION_ONCLICK)!=null) {
       onclick = (String) component.getAttributes().get(TobagoConstants.ATTR_ACTION_ONCLICK);
+      if (onclick.contains("@autoId")) {
+        onclick = onclick.replace("@autoId", component.getClientId(facesContext));
+      }
     } else if (defaultCommand) {
       ComponentUtil.findPage(component).setDefaultActionId(clientId);
 //      onclick = "Tobago.setAction('" + clientId + "');";

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/CommandTagExtraInfo.java Tue Oct 31 02:09:46 2006
@@ -32,12 +32,9 @@
     Object action = data.getAttribute("action");
     Object onclick = data.getAttribute("onclick");
     Object link = data.getAttribute("link");
-    if (action != null) {
-      if (onclick != null||link != null) {
+
+    if (link != null && !(action == null && onclick == null)) {
         return generateValidationMessages(data);
-      }
-    } else if (onclick != null&&link != null) {
-      return generateValidationMessages(data);
     }
     return EMPTY_MESSAGE;
   }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTag.java Tue Oct 31 02:09:46 2006
@@ -18,6 +18,7 @@
 
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_HEIGHT;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_LEFT;
+import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_TOP;
 import static org.apache.myfaces.tobago.TobagoConstants.ATTR_WIDTH;
 import org.apache.myfaces.tobago.component.ComponentUtil;
@@ -32,6 +33,7 @@
   private String height;
   private String left;
   private String top;
+  private String reset;
 
   public String getComponentType() {
     return UIPopup.COMPONENT_TYPE;
@@ -51,6 +53,7 @@
     ComponentUtil.setStringProperty(component, ATTR_HEIGHT, height);
     ComponentUtil.setStringProperty(component, ATTR_LEFT, left);
     ComponentUtil.setStringProperty(component, ATTR_TOP, top);
+    ComponentUtil.setBooleanProperty(component, ATTR_POPUP_RESET, reset);
   }
 
   public void setWidth(String width) {
@@ -69,5 +72,8 @@
     this.top = top;
   }
 
+  public void setReset(String reset) {
+    this.reset = reset;
+  }
 }
 

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/taglib/component/PopupTagDeclaration.java Tue Oct 31 02:09:46 2006
@@ -45,4 +45,13 @@
   @TagAttribute
   @UIComponentTagAttribute()
   void setTop(String top);
+
+  @TagAttribute
+  @UIComponentTagAttribute()
+  /**
+   * Flag indicating that the rendered value should set to false after rendering.
+   * This is for rendering a popup which contains no server actions
+   * and is closed on client side.
+   */
+  void setReset(String reset);
 }

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?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- 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 Tue Oct 31 02:09:46 2006
@@ -23,24 +23,25 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import static org.apache.myfaces.tobago.TobagoConstants.ATTR_POPUP_RESET;
 import static org.apache.myfaces.tobago.TobagoConstants.SUBCOMPONENT_SEP;
-import org.apache.myfaces.tobago.component.ComponentUtil;
+import org.apache.myfaces.tobago.ajax.api.AjaxRenderer;
+import org.apache.myfaces.tobago.ajax.api.AjaxUtils;
 import org.apache.myfaces.tobago.component.UIPopup;
 import org.apache.myfaces.tobago.context.ClientProperties;
 import org.apache.myfaces.tobago.context.ResourceManagerUtil;
 import org.apache.myfaces.tobago.renderkit.RendererBase;
-import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
-import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
 import org.apache.myfaces.tobago.renderkit.html.HtmlAttributes;
+import org.apache.myfaces.tobago.renderkit.html.HtmlConstants;
+import org.apache.myfaces.tobago.renderkit.html.HtmlRendererUtil;
 import org.apache.myfaces.tobago.webapp.TobagoResponseWriter;
 
 import javax.faces.component.UIComponent;
+import javax.faces.component.UIPanel;
 import javax.faces.context.FacesContext;
 import javax.faces.context.ResponseWriter;
 import java.io.IOException;
 
-public class PopupRenderer extends RendererBase {
+public class PopupRenderer extends RendererBase implements AjaxRenderer {
 
   private static final Log LOG = LogFactory.getLog(PopupRenderer.class);
 
@@ -56,6 +57,23 @@
     TobagoResponseWriter writer = (TobagoResponseWriter) facesContext.getResponseWriter();
     UIPopup component = (UIPopup) uiComponent;
     final String clientId = component.getClientId(facesContext);
+
+    writer.startElement(HtmlConstants.DIV, component);
+    writer.writeIdAttribute(clientId);
+    writer.writeComponentClass();
+    writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.popupBlink('" + clientId + "')", null);
+    if (ClientProperties.getInstance(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');", null);
+    }
+
+    encodeBeginInner(facesContext, writer, component);
+  }
+
+  private void encodeBeginInner(FacesContext facesContext, TobagoResponseWriter writer, UIPopup component) throws IOException {
+    final String clientId = component.getClientId(facesContext);
     final String contentDivId = clientId + CONTENT_ID_POSTFIX;
     final String left = component.getLeft();
     final String top = component.getTop();
@@ -77,17 +95,6 @@
     contentStyle.append("top: ");
     contentStyle.append(top != null ? top : "50");
     contentStyle.append("; ");
-
-    writer.startElement(HtmlConstants.DIV, component);
-    writer.writeIdAttribute(clientId);
-    writer.writeComponentClass();
-    writer.writeAttribute(HtmlAttributes.ONCLICK, "Tobago.popupBlink('" + clientId + "')", null);
-    if (ClientProperties.getInstance(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');", null);    }
-    writer.endElement(HtmlConstants.DIV);
     if (ClientProperties.getInstance(facesContext).getUserAgent().isMsie()) {
       writer.startElement(HtmlConstants.IFRAME, component);
       writer.writeIdAttribute(clientId + SUBCOMPONENT_SEP + HtmlConstants.IFRAME);
@@ -108,17 +115,34 @@
       UIComponent uiComponent) throws IOException {
     ResponseWriter writer = facesContext.getResponseWriter();
     UIPopup component = (UIPopup) uiComponent;
-    final String clientId = component.getClientId(facesContext);
+
+    encodeEndInner(facesContext, writer, component);
 
     writer.endElement(HtmlConstants.DIV);
+  }
+
+  private void encodeEndInner(FacesContext facesContext, ResponseWriter writer, UIPopup component) throws IOException {
+    final String clientId = component.getClientId(facesContext);
 
+    writer.endElement(HtmlConstants.DIV);
+    
     String setupScript = "Tobago.setupPopup('" + clientId + "', '"
         + component.getLeft() + "', '" + component.getTop() + "');";
     HtmlRendererUtil.writeJavascript(writer, setupScript);
+  }
 
-    if (ComponentUtil.getBooleanAttribute(component, ATTR_POPUP_RESET)) {
-      component.setRendered(false);
-    }
+
+  public void encodeAjax(FacesContext facesContext, UIComponent component) throws IOException {
+    AjaxUtils.checkParamValidity(facesContext, component, UIPanel.class);
+    TobagoResponseWriter writer
+        = (TobagoResponseWriter) facesContext.getResponseWriter();
+
+    encodeBeginInner(facesContext, writer, (UIPopup) component);
+    component.encodeChildren(facesContext);
+    encodeEndInner(facesContext, writer, (UIPopup) component);
+    facesContext.responseComplete();
   }
+
+
 }
 

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?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- 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 Tue Oct 31 02:09:46 2006
@@ -485,6 +485,7 @@
   border: 4px groove #ddeeff;
   background: #bbccdd;
   position: absolute;
+  cursor: default;
   box-sizing: border-box;
   -moz-box-sizing: border-box;
   -moz-background-clip: initial;

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?view=diff&rev=469435&r1=469434&r2=469435
==============================================================================
--- 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 Tue Oct 31 02:09:46 2006
@@ -379,33 +379,22 @@
         hidden.value = hidden.value + ":" + event.clientX + "x" + event.clientY;
       }
     }
-    this.submitAction(actionId);
-  },
-
-   /**
-    * remove the popup elements from dom tree.
-    */
-  closePickerPopup: function(popupId) {
-    var popup = this.element(popupId);
-    if (popup) {
-      popup.parentNode.removeChild(popup);
-    }
-    popup = this.element(popupId + Tobago.SUB_COMPONENT_SEP + "content");
-    if (popup) {
-      popup.parentNode.removeChild(popup);
-    }
-    popup = this.element(popupId + Tobago.SUB_COMPONENT_SEP + "iframe");
-    if (popup) {
-      popup.parentNode.removeChild(popup);
+    if (Tobago.Updater.hasTransport()) {
+      var idPrefix = hiddenId.substring(0, hiddenId.indexOf("Dimension"));
+      var popupId = idPrefix + "popup";
+      Tobago.openPopupWithAction(popupId, actionId);
+    } else {
+      this.submitAction(actionId);
     }
   },
+    
   /**
    * remove the popup elements from dom tree.
    */
   closePickerPopup2: function(obj) {
     var id = obj.id;
     var index = id.lastIndexOf(':');
-    this.closePickerPopup(id.substring(0, index));
+    this.closePopup(id.substring(0, index));
   },
 
 
@@ -738,6 +727,39 @@
     LOG.debug("popupId ist " + id);
     Tobago.addCssClass(id, "tobago-popup-blink");
     setTimeout("Tobago.removeCssClass('" + id + "', 'tobago-popup-blink')", 10);
+  },
+
+  /**
+   * remove a popup without request
+   *
+   */
+  closePopup: function(id) {
+    var divs = Tobago.page.getElementsByTagName("DIV");
+    for (var i = 0; i < divs.length; i++) {
+      var div = divs[i];
+      if (id.indexOf(div.id) == 0 && div.className.indexOf("tobago-popup-default") != -1) {
+        Tobago.page.removeChild(div);
+        return;
+      }
+    }
+  },
+
+  openPopupWithAction: function(popupId, actionId) {
+    var div = Tobago.element(popupId);
+    if (div) {
+      // something is wrong, doing full reload
+      Tobago.submitAction(actionId);
+    }
+
+    div = document.createElement('div');
+    div.id = popupId;
+    div.className = "tobago-popup-default";
+
+    Tobago.page.appendChild(div);
+
+    div = Tobago.element(popupId);
+    Tobago.addAjaxComponent(popupId);
+    Tobago.reloadComponent(popupId, actionId, {});
   },
 
 // -------- Util functions ----------------------------------------------------