myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1468335 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
Date Tue, 16 Apr 2013 09:32:31 GMT
Author: lofwyr
Date: Tue Apr 16 09:32:31 2013
New Revision: 1468335

URL: http://svn.apache.org/r1468335
Log:
TOBAGO-1249: The size/dimension of the page should be accessible via TobagoContext

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java?rev=1468335&r1=1468334&r2=1468335&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
Tue Apr 16 09:32:31 2013
@@ -21,6 +21,7 @@ package org.apache.myfaces.tobago.contex
 
 import org.apache.myfaces.tobago.internal.component.AbstractUIPage;
 import org.apache.myfaces.tobago.layout.Box;
+import org.apache.myfaces.tobago.layout.Dimension;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 
 import javax.faces.context.FacesContext;
@@ -36,6 +37,16 @@ public class TobagoContext {
     return page.getActionPosition();
   }
 
+  /**
+   * Returns the dimension of the page. Might be useful to set the size of a popup.
+   * E. g. <code>width="#{tobagoContext.pageDimension.width.pixel - 100}"</code>
+   */
+  public Dimension getPageDimension() {
+    FacesContext facesContext = FacesContext.getCurrentInstance();
+    AbstractUIPage page = ComponentUtils.findPage(facesContext);
+    return new Dimension(page.getWidth(), page.getHeight());
+  }
+
   public TobagoResourceBundle getResourceBundle() {
     return RESOURCE_BUNDLE;
   }



Mime
View raw message