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/11/19 10:54:08 UTC

svn commit: r1715137 - 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/context/ tobago-example/tobago-example-test/src/main/webapp/tobag...

Author: lofwyr
Date: Thu Nov 19 09:54:08 2015
New Revision: 1715137

URL: http://svn.apache.org/viewvc?rev=1715137&view=rev
Log:
TOBAGO-1510: ResourceManager: No longer need to provide measures for the themes

Modified:
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerUtils.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.java
    myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/tobago-resource/html/standard/standard/property/tobago-theme-config.properties
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
    myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManager.java Thu Nov 19 09:54:08 2015
@@ -19,9 +19,6 @@
 
 package org.apache.myfaces.tobago.context;
 
-import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.layout.Measure;
-
 import javax.faces.context.FacesContext;
 import javax.faces.render.Renderer;
 
@@ -35,12 +32,6 @@ public interface ResourceManager {
 
   String[] getStyles(FacesContext facesContext, String name);
 
-  Measure getThemeMeasure(FacesContext facesContext, Visual visual, String name);
-
-  Measure getThemeMeasure(FacesContext facesContext, Visual visual, String name, Measure defaultValue);
-
-  Measure getThemeMeasure(FacesContext facesContext, String rendererType, Markup markup, String name);
-
   /**
    * @param facesContext the current FacesContext
    * @param nameWithExtension The name with extension

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerUtils.java?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/context/ResourceManagerUtils.java Thu Nov 19 09:54:08 2015
@@ -19,9 +19,7 @@
 
 package org.apache.myfaces.tobago.context;
 
-import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.internal.context.ResourceManagerFactory;
-import org.apache.myfaces.tobago.layout.Measure;
 
 import javax.faces.context.FacesContext;
 import java.util.ArrayList;
@@ -170,12 +168,6 @@ public final class ResourceManagerUtils
     return ResourceManagerUtils.getImageWithPath(facesContext, name);
   }
 
-  public static Measure getThemeMeasure(
-      final FacesContext facesContext, final Visual visual, final String name) {
-    return ResourceManagerFactory.getResourceManager(facesContext).getThemeMeasure(
-        facesContext, visual.getRendererType(), visual.getCurrentMarkup(), name);
-  }
-
   /**
    * Detects if the value is an absolute resource or if the value has to be processed by the theme mechanism. A resource
    * will be treated as absolute, if the value starts with HTTP:, HTTPS:, FTP: or a slash. The case will be ignored by

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.java?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/context/ResourceManagerImpl.java Thu Nov 19 09:54:08 2015
@@ -21,13 +21,10 @@ package org.apache.myfaces.tobago.intern
 
 import org.apache.myfaces.tobago.application.ProjectStage;
 import org.apache.myfaces.tobago.component.RendererTypes;
-import org.apache.myfaces.tobago.component.Visual;
-import org.apache.myfaces.tobago.context.Markup;
 import org.apache.myfaces.tobago.context.ResourceManager;
 import org.apache.myfaces.tobago.context.Theme;
 import org.apache.myfaces.tobago.context.UserAgent;
 import org.apache.myfaces.tobago.internal.config.TobagoConfigImpl;
-import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.util.LocaleUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -174,62 +171,6 @@ public class ResourceManagerImpl impleme
     return getStrings(facesContext, name, null);
   }
 
-  public Measure getThemeMeasure(final FacesContext facesContext, final Visual visual, final String name) {
-    return getThemeMeasure(facesContext, visual.getRendererType(), visual.getCurrentMarkup(), name);
-  }
-
-  /**
-   * The default should not be needed, use defaulting from the theme mechanism.
-   */
-  public Measure getThemeMeasure(
-      final FacesContext facesContext, final Visual visual, final String name, final Measure defaultValue) {
-    final Measure measure = getThemeMeasure(facesContext, visual, name);
-    if (measure != null) {
-      return measure;
-    } else {
-//      LOG.warn("Using default-value for visual='" + visual + "' name='" + name + "'");
-      return defaultValue;
-    }
-  }
-
-  public Measure getThemeMeasure(
-      final FacesContext facesContext, final String rendererType, final Markup markup, final String name) {
-
-    final ClientPropertiesKey clientKey = ClientPropertiesKey.get(facesContext);
-    final ThemeConfigCacheKey cacheKey = new ThemeConfigCacheKey(clientKey, rendererType, markup, name);
-
-    MeasureValue result = themeCache.get(cacheKey);
-
-    if (result == null) {
-      final List properties = getPaths(clientKey, "", PROPERTY, "tobago-theme-config", EXT_NONE,
-          false, true, false, rendererType + "." + name, true, true);
-
-      Measure measure = null;
-      if (properties != null) {
-        measure = Measure.valueOf(properties.get(0));
-      }
-
-      if (markup != null) {
-        for (final String m : markup) {
-          final List mProperties = getPaths(clientKey, "", PROPERTY, "tobago-theme-config", EXT_NONE,
-              false, true, false, rendererType + "[" + m + "]" + "." + name, true, true);
-          if (mProperties != null) {
-            final Measure summand = Measure.valueOf(mProperties.get(0));
-            measure = summand.add(measure);
-          }
-        }
-      }
-
-      if (measure != null) {
-        result = new MeasureValue(measure);
-      } else {
-        result = MeasureValue.NULL;  // to mark and cache that this value is undefined.
-      }
-      themeCache.put(cacheKey, result);
-    }
-    return result.getValue();
-  }
-
   /**
    * {@inheritDoc}
    */

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/tobago-resource/html/standard/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/tobago-resource/html/standard/standard/property/tobago-theme-config.properties?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/tobago-resource/html/standard/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/tobago-resource/html/standard/standard/property/tobago-theme-config.properties Thu Nov 19 09:54:08 2015
@@ -16,7 +16,4 @@
 #
 
 # TOBAGO-1134
-Test[test].testValue=666
-
 Image.preferredHeight=100
-Image[double].preferredHeight=100

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/property/tobago-theme-config.properties Thu Nov 19 09:54:08 2015
@@ -59,10 +59,6 @@ Column.paddingLeft=2
 Column.paddingTop=2
 Column.paddingRight=2
 Column.paddingBottom=2
-Column[pure].paddingLeft=-2
-Column[pure].paddingTop=-2
-Column[pure].paddingRight=-2
-Column[pure].paddingBottom=-2
 
 ColumnSelector.fixedWidth=24
 
@@ -177,32 +173,5 @@ Textarea.minimumWidth=20
 Textarea.minimumHeight=36
 Textarea.preferredWidth=200
 
-Time.fixedWidth=105
-Time.minimumWidth=100
-Time.preferredWidth=100
-Time.maximumWidth=100
-Time.minimumHeight=25
-Time.preferredHeight=25
-Time.maximumHeight=25
-Time.css.border-left-width=0
-Time.css.border-top-width=0
-Time.css.border-right-width=0
-Time.css.border-bottom-width=0
-Time.css.padding-left=0
-Time.css.padding-top=0
-Time.css.padding-right=0
-Time.css.padding-bottom=0
-Time[timepicker].minimumWidth=-80
-Time[timepicker].preferredWidth=100
-Time[timepicker].maximumWidth=1900
-Time[timepicker].css.border-left-width=2
-Time[timepicker].css.border-top-width=2
-Time[timepicker].css.border-right-width=2
-Time[timepicker].css.border-bottom-width=2
-Time[timepicker].css.padding-left=2
-Time[timepicker].css.padding-top=2
-Time[timepicker].css.padding-right=2
-Time[timepicker].css.padding-bottom=2
-
 TreeMenuCommand.custom.padding-left=20
 TreeMenuLabel.custom.padding-left=20

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-speyside/src/main/resources/org/apache/myfaces/tobago/renderkit/html/speyside/standard/property/tobago-theme-config.properties Thu Nov 19 09:54:08 2015
@@ -96,25 +96,5 @@ Tab.paddingBottom=5
 
 Textarea.minimumHeight=33
 
-Time.minimumHeight=20
-Time.preferredHeight=20
-Time.maximumHeight=20
-#Time.css.border-left-width=1
-#Time.css.border-top-width=1
-#Time.css.border-right-width=1
-#Time.css.border-bottom-width=1
-#Time.css.padding-left=2
-#Time.css.padding-top=2
-#Time.css.padding-right=2
-#Time.css.padding-bottom=2
-Time[timepicker].css.border-left-width=1
-Time[timepicker].css.border-top-width=1
-Time[timepicker].css.border-right-width=1
-Time[timepicker].css.border-bottom-width=1
-#Time[timepicker].css.padding-left=2
-#Time[timepicker].css.padding-top=2
-#Time[timepicker].css.padding-right=2
-#Time[timepicker].css.padding-bottom=2
-
 TreeMenuCommand.custom.padding-left=15
 TreeMenuLabel.custom.padding-left=15

Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.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/util/RenderUtils.java?rev=1715137&r1=1715136&r2=1715137&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/RenderUtils.java Thu Nov 19 09:54:08 2015
@@ -20,12 +20,10 @@
 package org.apache.myfaces.tobago.renderkit.util;
 
 import org.apache.myfaces.tobago.component.Attributes;
-import org.apache.myfaces.tobago.component.Visual;
 import org.apache.myfaces.tobago.context.ResourceManagerUtils;
 import org.apache.myfaces.tobago.internal.component.AbstractUICommand;
 import org.apache.myfaces.tobago.internal.component.AbstractUIData;
 import org.apache.myfaces.tobago.internal.util.StringUtils;
-import org.apache.myfaces.tobago.layout.Measure;
 import org.apache.myfaces.tobago.model.ExpandedState;
 import org.apache.myfaces.tobago.model.SelectedState;
 import org.apache.myfaces.tobago.model.TreePath;
@@ -169,45 +167,6 @@ public class RenderUtils {
     }
   }
 
-  public static Measure calculateStringWidth(
-      final FacesContext facesContext, final UIComponent component, final String text) {
-    return calculateStringWidth(facesContext, (Visual) component, text, "tobago.font.widths");
-  }
-
-  public static Measure calculateStringWidth2(
-      final FacesContext facesContext, final UIComponent component, final String text) {
-    return calculateStringWidth(facesContext, (Visual) component, text, "tobago.font2.widths");
-  }
-
-  private static Measure calculateStringWidth(
-      final FacesContext facesContext, final Visual visual, final String text, final String type) {
-    if (text == null) {
-      return Measure.ZERO;
-    }
-    int width = 0;
-    int defaultCharWidth = 10;
-    try {
-      defaultCharWidth = ResourceManagerUtils.getThemeMeasure(facesContext, visual, "fontWidth").getPixel();
-    } catch (final NullPointerException e) {
-      LOG.warn("no value for 'fontWidth' for type '" + visual.getRendererType() + "' found in theme-config");
-    }
-
-    final String fontWidths = ResourceManagerUtils.getProperty(facesContext, "tobago", type);
-
-    for (final char c : text.toCharArray()) {
-      if (fontWidths != null && c >= 32 && c < 128) { // "normal" char in precomputed range
-        final int begin = (c - 32) * 2;
-        width += Integer.parseInt(fontWidths.substring(begin, begin + 2), 16);
-      } else {
-        width += defaultCharWidth;
-      }
-    }
-
-    width += text.length(); // fixes the problem, that sometime some browsers add some pixels
-
-    return Measure.valueOf(width);
-  }
-
   public static String currentValue(final UIComponent component) {
     String currentValue = null;
     if (component instanceof ValueHolder) {