You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/09/11 16:26:56 UTC

svn commit: r1702479 - in /myfaces/tobago/branches/tobago-3.0.x: ./ tobago-core/src/main/java/org/apache/myfaces/tobago/context/ tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/ tobago-core/src/main/java/org/apache/myfaces/tobago...

Author: lofwyr
Date: Fri Sep 11 14:26:55 2015
New Revision: 1702479

URL: http://svn.apache.org/r1702479
Log:
TOBAGO-1470: Tobago 3: Layout concept changed

Removed:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Box.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Dimension.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/Position.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/PageRendererBase.java
Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-3.0.txt
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ClientProperties.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-3.0.txt
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-3.0.txt?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-3.0.txt (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-3.0.txt Fri Sep 11 14:26:55 2015
@@ -54,3 +54,12 @@ Done:
       </f:facet>
       ... content ...
     </tc:panel>
+
+No longer supported:
+* AbstractUIPage.getActionPosition()
+* AbstractUIPage.setActionPosition()
+* class Box
+* class Dimension
+* class Position
+* ClientProperties.pageWidth
+* ClientProperties.pageHeight

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ClientProperties.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ClientProperties.java?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ClientProperties.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ClientProperties.java Fri Sep 11 14:26:55 2015
@@ -21,8 +21,6 @@ package org.apache.myfaces.tobago.contex
 
 import org.apache.myfaces.tobago.config.TobagoConfig;
 import org.apache.myfaces.tobago.internal.context.ClientPropertiesKey;
-import org.apache.myfaces.tobago.internal.util.Deprecation;
-import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.util.VariableResolverUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,7 +28,6 @@ import org.slf4j.LoggerFactory;
 import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 import java.io.Serializable;
-import java.util.Locale;
 
 /**
  * The ClientProperties contains data, which are individual for each user.
@@ -57,10 +54,7 @@ public class ClientProperties implements
   private Theme theme;
   private UserAgent userAgent = UserAgent.DEFAULT;
 
-  private Measure pageWidth;
-  private Measure pageHeight;
-
-  /** 
+  /**
    * managed bean constructor
    */
   public ClientProperties() {
@@ -128,66 +122,6 @@ public class ClientProperties implements
     reset();
   }
 
-  /**
-   * @deprecated since 2.0.0, please use {@link javax.faces.component.UIViewRoot#getLocale()}
-   */
-  public Locale getLocale() {
-    Deprecation.LOG.warn("Please get locale via UIViewRoot.");
-    return FacesContext.getCurrentInstance().getViewRoot().getLocale();
-  }
-
-  /**
-   * @deprecated since 2.0.0
-   * This setter should not be called from the application directly,
-   * but via {@link javax.faces.component.UIViewRoot#setLocale(Locale locale)}
-   */
-  public void setLocale(final Locale locale) {
-    Deprecation.LOG.warn("Please set locale via UIViewRoot.");
-    FacesContext.getCurrentInstance().getViewRoot().setLocale(locale);
-  }
-
-  /** @deprecated since Tobago 3.0 */
-  @Deprecated
-  public Measure getVerticalScrollbarWeight() {
-    Deprecation.LOG.error("verticalScrollbarWeight");
-    return Measure.ZERO;
-  }
-
-  /** @deprecated since Tobago 3.0 */
-  @Deprecated
-  public void setVerticalScrollbarWeight(final Measure verticalScrollbarWeight) {
-    Deprecation.LOG.error("verticalScrollbarWeight");
-  }
-
-  /** @deprecated since Tobago 3.0 */
-  @Deprecated
-  public Measure getHorizontalScrollbarWeight() {
-    Deprecation.LOG.error("horizontalScrollbarWeight");
-    return Measure.ZERO;
-  }
-
-  /** @deprecated since Tobago 3.0 */
-  @Deprecated
-  public void setHorizontalScrollbarWeight(final Measure horizontalScrollbarWeight) {
-    Deprecation.LOG.error("horizontalScrollbarWeight");
-  }
-
-  public Measure getPageWidth() {
-    return pageWidth;
-  }
-
-  public void setPageWidth(final Measure pageWidth) {
-    this.pageWidth = pageWidth;
-  }
-
-  public Measure getPageHeight() {
-    return pageHeight;
-  }
-
-  public void setPageHeight(final Measure pageHeight) {
-    this.pageHeight = pageHeight;
-  }
-
   public void updateUserAgent(final FacesContext facesContext) {
     final ExternalContext externalContext = facesContext.getExternalContext();
     final String requestUserAgent = externalContext.getRequestHeaderMap().get("User-Agent");

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/TobagoContext.java Fri Sep 11 14:26:55 2015
@@ -20,10 +20,6 @@
 package org.apache.myfaces.tobago.context;
 
 import org.apache.myfaces.tobago.config.TobagoConfig;
-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;
 
@@ -32,22 +28,6 @@ public class TobagoContext {
   private static final TobagoResourceBundle RESOURCE_BUNDLE = new TobagoResourceBundle();
   private static final TobagoMessageBundle MESSAGE_BUNDLE = new TobagoMessageBundle();
 
-  public Box getActionPosition() {
-    final FacesContext facesContext = FacesContext.getCurrentInstance();
-    final AbstractUIPage page = ComponentUtils.findPage(facesContext);
-    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() {
-    final FacesContext facesContext = FacesContext.getCurrentInstance();
-    final AbstractUIPage page = ComponentUtils.findPage(facesContext);
-    return new Dimension(page.getWidth(), page.getHeight());
-  }
-
   public TobagoResourceBundle getResourceBundle() {
     return RESOURCE_BUNDLE;
   }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUIPage.java Fri Sep 11 14:26:55 2015
@@ -27,7 +27,6 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.ajax.AjaxResponseRenderer;
 import org.apache.myfaces.tobago.internal.util.FacesContextUtils;
 import org.apache.myfaces.tobago.internal.webapp.TobagoMultipartFormdataRequest;
-import org.apache.myfaces.tobago.layout.Box;
 import org.apache.myfaces.tobago.layout.LayoutContainer;
 import org.apache.myfaces.tobago.layout.LayoutManager;
 import org.apache.myfaces.tobago.layout.Measure;
@@ -69,8 +68,6 @@ public abstract class AbstractUIPage ext
 
   private String actionId;
 
-  private Box actionPosition;
-
   @Override
   public boolean getRendersChildren() {
     return true;
@@ -314,14 +311,6 @@ public abstract class AbstractUIPage ext
     this.actionId = actionId;
   }
 
-  public Box getActionPosition() {
-    return actionPosition;
-  }
-
-  public void setActionPosition(final Box actionPosition) {
-    this.actionPosition = actionPosition;
-  }
-
   public void onComponentPopulated(final FacesContext facesContext, final UIComponent parent) {
 /*
     if (getLayoutManager() == null) {

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/20-popup/popup.xhtml Fri Sep 11 14:26:55 2015
@@ -126,8 +126,7 @@
 
       <tc:button label="Open here">
         <f:facet name="popup">
-          <tc:popup width="180" height="110" id="positioned_popup"
-                    left="#{tobagoContext.actionPosition.right.pixel + 5}" top="#{tobagoContext.actionPosition.top.pixel}">
+          <tc:popup width="180" height="110" id="positioned_popup">
             <f:facet name="layout">
               <tc:gridLayout columns="*" rows="*"/>
             </f:facet>

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/PageRenderer.java Fri Sep 11 14:26:55 2015
@@ -41,7 +41,7 @@ import org.apache.myfaces.tobago.interna
 import org.apache.myfaces.tobago.internal.util.StringUtils;
 import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.portlet.PortletUtils;
-import org.apache.myfaces.tobago.renderkit.PageRendererBase;
+import org.apache.myfaces.tobago.renderkit.LayoutComponentRendererBase;
 import org.apache.myfaces.tobago.renderkit.css.Classes;
 import org.apache.myfaces.tobago.renderkit.html.BootstrapClass;
 import org.apache.myfaces.tobago.renderkit.html.DataAttributes;
@@ -71,7 +71,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-public class PageRenderer extends PageRendererBase {
+public class PageRenderer extends LayoutComponentRendererBase {
 
   private static final Logger LOG = LoggerFactory.getLogger(PageRenderer.class);
 
@@ -88,10 +88,18 @@ public class PageRenderer extends PageRe
 
   @Override
   public void decode(final FacesContext facesContext, final UIComponent component) {
-    super.decode(facesContext, component);
-    final String clientId = component.getClientId(facesContext);
-    final ExternalContext externalContext = facesContext.getExternalContext();
+    final AbstractUIPage page = (AbstractUIPage) component;
+    final String clientId = page.getClientId(facesContext);
+
+    final String actionIdName = clientId + ComponentUtils.SUB_SEPARATOR + "form-action";
+    final String newActionId = facesContext.getExternalContext().getRequestParameterMap().get(actionIdName);
+    if (LOG.isDebugEnabled()) {
+      LOG.debug("action = " + newActionId);
+    }
+    page.setActionId(newActionId);
+    FacesContextUtils.setActionId(facesContext, newActionId);
 
+    final ExternalContext externalContext = facesContext.getExternalContext();
     // last focus
     final String lastFocusId =
         externalContext.getRequestParameterMap().get(clientId + ComponentUtils.SUB_SEPARATOR + LAST_FOCUS_ID);
@@ -308,12 +316,6 @@ public class PageRenderer extends PageRe
 
     writer.startElement(HtmlElements.INPUT, null);
     writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
-    writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "action-position");
-    writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "action-position");
-    writer.endElement(HtmlElements.INPUT);
-
-    writer.startElement(HtmlElements.INPUT, null);
-    writer.writeAttribute(HtmlAttributes.TYPE, HtmlInputTypes.HIDDEN, false);
     writer.writeNameAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-clientDimension");
     writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "form-clientDimension");
     writer.endElement(HtmlElements.INPUT);
@@ -630,26 +632,4 @@ public class PageRenderer extends PageRe
       return Measure.ZERO;
     }
   }
-
-  @Override
-  public Measure getWidth(final FacesContext facesContext, final Configurable component) {
-    // width of the actual browser window
-    final Measure width = ClientProperties.getInstance(facesContext).getPageWidth();
-    if (width != null) {
-      return width;
-    } else {
-      return super.getWidth(facesContext, component);
-    }
-  }
-
-  @Override
-  public Measure getHeight(final FacesContext facesContext, final Configurable component) {
-    // height of the actual browser window
-    final Measure height = ClientProperties.getInstance(facesContext).getPageHeight();
-    if (height != null) {
-      return height;
-    } else {
-      return super.getHeight(facesContext, component);
-    }
-  }
 }

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1702479&r1=1702478&r2=1702479&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri Sep 11 14:26:55 2015
@@ -210,7 +210,6 @@ var Tobago = {
     this.action = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'form-action');
     this.contextPath = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'context-path');
     this.blankPage = this.contextPath.value + '/org/apache/myfaces/tobago/renderkit/html/standard/blank.html';
-    this.actionPosition = this.element(this.page.id + this.SUB_COMPONENT_SEP + 'action-position');
 
     this.addBindEventListener(window, 'unload', this, 'onUnload');
 
@@ -341,7 +340,6 @@ var Tobago = {
     delete this.page;
     delete this.form;
     delete this.action;
-    delete this.actionPosition;
     delete this.contextPath;
     delete this.blankPage;
     delete this.lastFocusId;
@@ -412,8 +410,6 @@ var Tobago = {
       this.form.appendChild(lastFocusId);
     }
 
-    Tobago.setActionPosition(source);
-
     Tobago.Transport.request(function() {
       if (!this.isSubmit) {
         this.isSubmit = true;
@@ -462,17 +458,6 @@ var Tobago = {
     }, true);
   },
 
-  setActionPosition: function(source) {
-    var offset = jQuery(source).offset();
-    var sourceWidth = Tobago.getWidth(source);
-    var sourceHeight = Tobago.getHeight(source);
-    Tobago.actionPosition.value
-        = (offset ? parseInt(offset.left) + 'px,' : '0px,')
-        + (offset ? parseInt(offset.top) + 'px,' : '0px,')
-        + sourceWidth + 'px,' + sourceHeight + 'px';
-//    alert("source='" + source + "' action-position=" + Tobago.actionPosition.value);
-  },
-
   getJsfState: function() {
     var stateContainer = Tobago.element(Tobago.page.id + Tobago.SUB_COMPONENT_SEP + 'jsf-state-container');
     var jsfState = '';
@@ -2017,9 +2002,6 @@ Tobago.Updater = {
         }
       }
 
-      Tobago.setActionPosition(source);
-
-
       if (!Tobago.partialRequestIds) {
         var hidden = document.createElement('input');
         hidden.type = 'hidden';