myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject [myfaces-tobago] 02/02: TOBAGO-1927: PageState width/height should be used for layout, if defined
Date Thu, 06 Sep 2018 07:26:52 GMT
This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch tobago-2.0.x
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 23ebe17781f7ff2c6de1543b483212c4c4306ba1
Author: Udo Schnurpfeil <lofwyr@apache.org>
AuthorDate: Thu Sep 6 09:25:42 2018 +0200

    TOBAGO-1927: PageState width/height should be used for layout, if defined
---
 .../java/org/apache/myfaces/tobago/model/PageStateImpl.java |  4 +++-
 .../renderkit/html/standard/standard/tag/PageRenderer.java  | 13 +++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
index ab9e18c..4b9210c 100644
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
+++ b/tobago-core/src/main/java/org/apache/myfaces/tobago/model/PageStateImpl.java
@@ -19,12 +19,14 @@
 
 package org.apache.myfaces.tobago.model;
 
+import java.io.Serializable;
+
 /**
  * @deprecated since 1.5.0, please configure constraints for the page size with a tc:gridLayoutConstraints
tag 
  * inside the tc:page tag.
  */
 @Deprecated
-public class PageStateImpl implements PageState {
+public class PageStateImpl implements PageState, Serializable {
 
   private int clientWidth;
   private int clientHeight;
diff --git a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
index 821725b..b1717db 100644
--- a/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
+++ b/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
@@ -40,6 +40,7 @@ import org.apache.myfaces.tobago.internal.util.MimeTypeUtils;
 import org.apache.myfaces.tobago.internal.util.ResponseUtils;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.layout.Measure;
+import org.apache.myfaces.tobago.model.PageState;
 import org.apache.myfaces.tobago.portlet.PortletUtils;
 import org.apache.myfaces.tobago.renderkit.PageRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -724,6 +725,12 @@ public class PageRenderer extends PageRendererBase {
 
   @Override
   public Measure getWidth(final FacesContext facesContext, final Configurable component)
{
+    final UIPage page = (UIPage) component;
+    final PageState pageState = page.getPageState(facesContext);
+    final int fromState = pageState != null ? pageState.getClientWidth() : 0;
+    if (fromState > 0) {
+      return Measure.valueOf(fromState);
+    }
     // width of the actual browser window
     final Measure width = ClientProperties.getInstance(facesContext).getPageWidth();
     if (width != null) {
@@ -735,6 +742,12 @@ public class PageRenderer extends PageRendererBase {
 
   @Override
   public Measure getHeight(final FacesContext facesContext, final Configurable component)
{
+    final UIPage page = (UIPage) component;
+    final PageState pageState = page.getPageState(facesContext);
+    final int fromState = pageState != null ? pageState.getClientHeight() : 0;
+    if (fromState > 0) {
+      return Measure.valueOf(fromState);
+    }
     // height of the actual browser window
     final Measure height = ClientProperties.getInstance(facesContext).getPageHeight();
     if (height != null) {


Mime
View raw message