myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r934280 - in /myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main: java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java webapp/demos/panelPageSkinDemo.jspx
Date Thu, 15 Apr 2010 03:42:35 GMT
Author: jwaldman
Date: Thu Apr 15 03:42:34 2010
New Revision: 934280

URL: http://svn.apache.org/viewvc?rev=934280&view=rev
Log:
TRINIDAD-1776 setting skin to dirty only has effect if it is set on initial render
beef up the panelPageSkinDemo.jspx to set skin to be dirty not on every render, but only when
the user presses the Set Skin Dirty button.

Modified:
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java?rev=934280&r1=934279&r2=934280&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/SkinDirtyPhaseListener.java
Thu Apr 15 03:42:34 2010
@@ -1,9 +1,12 @@
 package org.apache.myfaces.trinidaddemo;
 
+import javax.faces.event.ActionEvent;
 import javax.faces.event.PhaseEvent;
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 
+import javax.servlet.ServletContext;
+
 import org.apache.myfaces.trinidad.context.RenderingContext;
 import org.apache.myfaces.trinidad.context.RequestContext;
 
@@ -22,25 +25,46 @@ public class SkinDirtyPhaseListener
 
   public void afterPhase(PhaseEvent phaseEvent)
   {
+
   }
 
   public void beforePhase(PhaseEvent phaseEvent)
   {
     // Add event code here...
-    System.out.println("***PhaseTracker: Before Phase: " + phaseEvent.getPhaseId());
+    System.out.println("***PhaseTracker: After Phase: " + phaseEvent.getPhaseId());
     RenderingContext rContext = RenderingContext.getCurrentInstance();
+
     if (rContext != null)
     {
-      System.out.println("Set Skin to dirty");
-      rContext.getSkin().setDirty(true);
+      System.out.println("Set Skin to dirty if button was pressed, and it is set to :" +
_pressedButton);
+      if (_pressedButton)
+      {
+        System.out.println("Setting the skin to be dirty will allow you to refresh your browser
and see any changes to the skin's css file immediately.");
+        rContext.getSkin().setDirty(true);
+        _pressedButton = false;
+      }
+      else 
+      {
+        System.out.println("Set Skin to not be dirty");
+        rContext.getSkin().setDirty(false);
+      }
     }
     else
-      System.out.println("rContext in _beforePhase is null!");
+      System.out.println("rContext in _afterPhase is null!");
 
   }
 
   public PhaseId getPhaseId()
   {
-    return PhaseId.ANY_PHASE;
+    return PhaseId.RESTORE_VIEW;
+  }
+  
+  public void buttonAction(ActionEvent action) {
+    System.out.println("You pressed the button");
+    _pressedButton = true;
+    
   }
+  
+  
+  private boolean _pressedButton = false;
 }

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx?rev=934280&r1=934279&r2=934280&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
(original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/demos/panelPageSkinDemo.jspx
Thu Apr 15 03:42:34 2010
@@ -89,6 +89,8 @@
                   <tr:selectItem label="locale" value="localeDemo"/>
                 </tr:selectOneChoice>
                 <tr:commandButton text="Go"/>
+                <tr:commandButton text="Set Skin Dirty" actionListener="#{skinDirty.buttonAction}"/>
+                <tr:outputText value="(to immediately see skin's css changes)" />
                 <tr:goLink id="goLinkId" text="EmailablePageMode" 
                   destination="panelPageSkinDemo.jspx?org.apache.myfaces.trinidad.agent.email=true"
/>
                 <tr:selectBooleanCheckbox text="true" label="Label (red in purple skin
+ email mode):" value="true"/>



Mime
View raw message