Author: jkuhnert
Date: Sat Apr 21 07:52:07 2007
New Revision: 531043

URL: http://svn.apache.org/viewvc?view=rev&rev=531043
Log:
-) Slight perf improvement of LocaleList demo.

-) Added stack trace dump to HiveMindExpressionCompiler on statements that are 
falling through to "fail safe" generation.

Modified:
    tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
    
tapestry/tapestry4/trunk/tapestry-contrib/src/descriptor/META-INF/hivemodule.xml
    
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/services/impl/RoundedCornerService.java
    
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
    
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
    
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java

Modified: tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/pom.xml?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/pom.xml Sat Apr 21 07:52:07 2007
@@ -36,6 +36,10 @@
             <artifactId>hivemind-lib</artifactId>
         </dependency>
         <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymock</artifactId>
             <scope>provided</scope>

Modified: 
tapestry/tapestry4/trunk/tapestry-contrib/src/descriptor/META-INF/hivemodule.xml
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/descriptor/META-INF/hivemodule.xml?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-contrib/src/descriptor/META-INF/hivemodule.xml
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-contrib/src/descriptor/META-INF/hivemodule.xml
 Sat Apr 21 07:52:07 2007
@@ -66,6 +66,7 @@
                 <set-object property="exceptionReporter" 
value="infrastructure:requestExceptionReporter"/>
                 <set-object property="response" 
value="infrastructure:response"/>
                 <set-object property="linkFactory" 
value="infrastructure:linkFactory"/>
+                <set-object property="request" value="infrastructure:request" 
/>
             </construct>
         </invoke-factory>
     </service-point>

Modified: 
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/services/impl/RoundedCornerService.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/services/impl/RoundedCornerService.java?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/services/impl/RoundedCornerService.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/services/impl/RoundedCornerService.java
 Sat Apr 21 07:52:07 2007
@@ -8,8 +8,10 @@
 import org.apache.tapestry.services.LinkFactory;
 import org.apache.tapestry.services.ServiceConstants;
 import org.apache.tapestry.util.ContentType;
+import org.apache.tapestry.web.WebRequest;
 import org.apache.tapestry.web.WebResponse;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.HashMap;
@@ -37,6 +39,8 @@
 
     private LinkFactory _linkFactory;
 
+    private WebRequest _request;
+
     private WebResponse _response;
 
     private RoundedCornerGenerator _generator = new RoundedCornerGenerator();
@@ -68,6 +72,12 @@
 
         try {
 
+            if (_request.getHeader("If-Modified-Since") != null)
+            {
+                _response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
+                return;
+            }
+
             byte[] data = _generator.buildCorner(color, bgColor, width, 
height, angle);
 
             _response.setDateHeader("Expires", EXPIRES);
@@ -118,6 +128,12 @@
     public void setLinkFactory(LinkFactory linkFactory)
     {
         _linkFactory = linkFactory;
+    }
+
+    /* Injected */
+    public void setRequest(WebRequest request)
+    {
+        _request = request;
     }
 
     /* Injected */

Modified: 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/context/LocaleList.html
 Sat Apr 21 07:52:07 2007
@@ -20,17 +20,17 @@
     .localeList p { margin: 0 10px;}
 
     .roundtop {
-        background: url("/rounded?c=2A78B0&bc=white&w=8&h=8&a=tr") no-repeat 
top right;
+        background: url("rounded?c=2A78B0&bc=white&w=8&h=8&a=tr") no-repeat 
top right;
     }
     .selectedRoundtop {
-        background: url("/rounded?c=efefef&bc=white&w=8&h=8&a=tr") no-repeat 
top right;
+        background: url("rounded?c=efefef&bc=white&w=8&h=8&a=tr") no-repeat 
top right;
     }
 
     .roundbottom {
-        background: url("/rounded?c=2A78B0&bc=white&w=8&h=8&a=br") no-repeat 
top right;
+        background: url("rounded?c=2A78B0&bc=white&w=8&h=8&a=br") no-repeat 
top right;
     }
     .selectedRoundbottom {
-        background: url("/rounded?c=efefef&bc=white&w=8&h=8&a=br") no-repeat 
top right;
+        background: url("rounded?c=efefef&bc=white&w=8&h=8&a=br") no-repeat 
top right;
     }
 
     img.corner {
@@ -72,6 +72,15 @@
                padding: 0.4em;
                border:1px dotted #D6AE33;
        }
+
+    .clear {
+        clear:both;
+        display:block;
+        float:left;
+        width:100%;
+        height: 20px;
+    }
+
 </style>
 
 <span jwcid="[EMAIL PROTECTED]">
@@ -112,6 +121,8 @@
 
     </div>
 </div>
-<br/>
+
+<p class="clear" />
+<p class="clear" />
 
 </span>

Modified: 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-examples/TimeTracker/src/java/org/apache/tapestry/timetracker/page/LocaleList.java
 Sat Apr 21 07:52:07 2007
@@ -28,12 +28,30 @@
 {
 
     public static Locale[] LOCALES = Locale.getAvailableLocales();
-    
-    public abstract Locale getCurrLocale();
+
+    public abstract Locale getStoredCurrent();
+    public abstract void setStoredCurrent(Locale locale);
+
+    public abstract int getCurrentHash();
+    public abstract void setCurrentHash(int hash);
+
+    public Locale getCurrLocale()
+    {
+        return getStoredCurrent();
+    }
+
+    public void setCurrLocale(Locale locale)
+    {
+        setStoredCurrent(locale);
+        setCurrentHash(locale.hashCode());
+    }
     
     public abstract void setSelected(Locale locale);
     public abstract Locale getSelected();
-    
+
+    public abstract void setSelectedHash(int hash);
+    public abstract int getSelectedHash();
+
     public abstract void setStatus(String status);
     
     public abstract ResponseBuilder getBuilder();
@@ -41,18 +59,20 @@
     public void selectLocale(BrowserEvent event, String language, String 
country, String variant)
     {
         setSelected(new Locale(language, country, variant));
+        setSelectedHash(getSelected().hashCode());
+        
         setStatus(event.toString());
         getBuilder().updateComponent("status");
     }
 
     public boolean isCurrentSelected()
     {
-        return getSelected() != null && 
getCurrLocale().toString().equals(getSelected().toString());
+        return getSelected() != null && getCurrentHash() == getSelectedHash();
     }
 
     public String getRoundedUrl(String anchor)
     {
-        return "/rounded?c=" +
+        return "rounded?c=" +
                (isCurrentSelected() ? "efefef" : "2A78B0")
                + "&bc=white&w=8&h=8&a=" + anchor;
     }

Modified: 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
URL: 
http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java?view=diff&rev=531043&r1=531042&r2=531043
==============================================================================
--- 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
 (original)
+++ 
tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/HiveMindExpressionCompiler.java
 Sat Apr 21 07:52:07 2007
@@ -151,6 +151,7 @@
 
             } catch (UnsupportedCompilationException uc) {
 
+                uc.printStackTrace();
                 // The target object may not fully resolve yet because of a 
partial tree with a null somewhere, we
                 // don't want to bail out forever because it might be 
enhancable on another pass eventually
                 return;
@@ -174,6 +175,8 @@
 
             } catch (UnsupportedCompilationException uc) {
 
+                // uc.printStackTrace();
+                
                 if (_log.isDebugEnabled())
                     _log.warn("Unsupported setter compilation caught: " + 
uc.getMessage() + " for expression: " + expression.toString());
 


Reply via email to