struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r481236 - in /struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase: template/DynTemplateAction.java test/NoForward.java test/TestActionTileAction.java test/TestTileController.java
Date Fri, 01 Dec 2006 13:18:46 GMT
Author: apetrelli
Date: Fri Dec  1 05:18:45 2006
New Revision: 481236

URL: http://svn.apache.org/viewvc?view=rev&rev=481236
Log:
SB-91
Second bunch of resolved compiling issues.

Modified:
    struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/template/DynTemplateAction.java
    struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/NoForward.java
    struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestActionTileAction.java
    struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestTileController.java

Modified: struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/template/DynTemplateAction.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/template/DynTemplateAction.java?view=diff&rev=481236&r1=481235&r2=481236
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/template/DynTemplateAction.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/template/DynTemplateAction.java
Fri Dec  1 05:18:45 2006
@@ -28,7 +28,7 @@
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
-import org.apache.tiles.ComponentDefinition;
+import org.apache.tiles.definition.ComponentDefinition;
 
 
 /**
@@ -68,12 +68,11 @@
     String path = "/tutorial";
       // set definition 'contents'
     //definition.setTemplate( "/tutorial/basic/myFramesetLayout.jsp" );
-    definition.put( "title", "My first dynamic frameset page", true );
-      // using type="string" is the same as direct=true
-    definition.put( "header", path + "/common/header.jsp", "string", null );
-    definition.put( "footer", path + "/common/footer.jsp", true );
-    definition.put( "menu", path + "/basic/menu.jsp", true );
-    definition.put( "body", path + "/basic/helloBody.jsp", true );
+    definition.put("title", "My first dynamic frameset page", "string", null);
+    definition.put("header", path + "/common/header.jsp", "string", null );
+    definition.put("footer", path + "/common/footer.jsp");
+    definition.put("menu", path + "/basic/menu.jsp");
+    definition.put("body", path + "/basic/helloBody.jsp");
 
     System.out.println( "definition=" + definition );
       // Save our definition as a bean :

Modified: struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/NoForward.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/NoForward.java?view=diff&rev=481236&r1=481235&r2=481236
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/NoForward.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/NoForward.java
Fri Dec  1 05:18:45 2006
@@ -30,6 +30,7 @@
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 import org.apache.tiles.ComponentContext;
+import org.apache.tiles.access.TilesAccess;
 
 
 /**
@@ -74,14 +75,9 @@
                                  HttpServletResponse response)
         throws Exception {
       // Try to retrieve tile context
-    ComponentContext context = ComponentContext.getContext( request );
-    if( context == null )
-      { // Not found, create a context
-        // This context will be detected by the TilesRequestProcessor which will do an include
-        // instead of a forward.
-      ComponentContext tileContext = new ComponentContext( );
-      ComponentContext.setContext( tileContext, request);
-      }
+    
+      ComponentContext context = TilesAccess.getContainer(request.getSession()
+            .getServletContext()).getComponentContext(request, response);;
 	  return (mapping.findForward("success"));
     }
 

Modified: struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestActionTileAction.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestActionTileAction.java?view=diff&rev=481236&r1=481235&r2=481236
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestActionTileAction.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestActionTileAction.java
Fri Dec  1 05:18:45 2006
@@ -24,16 +24,13 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+
 import org.apache.struts.action.Action;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 import org.apache.tiles.ComponentContext;
-import org.apache.tiles.ComponentDefinition;
-import org.apache.tiles.DefinitionsFactoryException;
-import org.apache.tiles.DefinitionsUtil;
-import org.apache.tiles.FactoryNotFoundException;
-import org.apache.tiles.NoSuchDefinitionException;
+import org.apache.tiles.access.TilesAccess;
 
 
 /**
@@ -72,45 +69,42 @@
 	throws Exception {
 
       // Try to retrieve tile context
-    ComponentContext context = ComponentContext.getContext( request );
-    if( context == null )
-      {
-      request.setAttribute( "actionError", "Can't get component context.");
-      return (mapping.findForward("failure"));
-      }
+    ComponentContext context = TilesAccess.getContainer(request.getSession()
+            .getServletContext()).getComponentContext(request, response);;
       // Get requested test from tile parameter
     String param;
 
       // Set a definition in this action
-    param = (String)context.getAttribute( "set-definition-name" );
+    param = (String) context.getAttribute("set-definition-name").getValue();
     if( param != null )
       {
-      try
-        {
+        // FIXME Currently I don't know how to get a definition!
+//      try
+//        {
           // Read definition from factory, but we can create it here.
-        ComponentDefinition definition = DefinitionsUtil.getDefinition( param, request, getServlet().getServletContext()
);
-        //definition.putAttribute( "attributeName", "aValue" );
-        DefinitionsUtil.setActionDefinition( request, definition);
-        }
-       catch( FactoryNotFoundException ex )
-        {
-        request.setAttribute( "actionError", "Can't get definition factory.");
-        return (mapping.findForward("failure"));
-        }
-       catch( NoSuchDefinitionException ex )
-        {
-        request.setAttribute( "actionError", "Can't get definition '" + param +"'.");
-        return (mapping.findForward("failure"));
-        }
-       catch( DefinitionsFactoryException ex )
-        {
-        request.setAttribute( "actionError", "General error '" + ex.getMessage() +"'.");
-        return (mapping.findForward("failure"));
+//        ComponentDefinition definition = DefinitionsUtil.getDefinition( param, request,
getServlet().getServletContext() );
+//        //definition.putAttribute( "attributeName", "aValue" );
+//        DefinitionsUtil.setActionDefinition( request, definition);
         }
-      }
+//       catch( FactoryNotFoundException ex )
+//        {
+//        request.setAttribute( "actionError", "Can't get definition factory.");
+//        return (mapping.findForward("failure"));
+//        }
+//       catch( NoSuchDefinitionException ex )
+//        {
+//        request.setAttribute( "actionError", "Can't get definition '" + param +"'.");
+//        return (mapping.findForward("failure"));
+//        }
+//       catch( DefinitionsFactoryException ex )
+//        {
+//        request.setAttribute( "actionError", "General error '" + ex.getMessage() +"'.");
+//        return (mapping.findForward("failure"));
+//        }
+//      }
 
       // Overload a parameter
-    param = (String)context.getAttribute( "set-attribute" );
+    param = (String) context.getAttribute("set-attribute").getValue();
     if( param != null )
       {
       context.putAttribute( param, context.getAttribute( "set-attribute-value" ));

Modified: struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestTileController.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestTileController.java?view=diff&rev=481236&r1=481235&r2=481236
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestTileController.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-showcase/src/main/java/org/apache/tiles/showcase/test/TestTileController.java
Fri Dec  1 05:18:45 2006
@@ -29,8 +29,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.tiles.ComponentAttribute;
 import org.apache.tiles.ComponentContext;
-import org.apache.tiles.ControllerSupport;
+import org.apache.tiles.preparer.ViewPreparerSupport;
 
 
   /**
@@ -38,7 +39,7 @@
    * This controller modify title by adding "ok".
    * @version $Rev$ $Date$
    */
-public class TestTileController extends ControllerSupport
+public class TestTileController extends ViewPreparerSupport
 {
 
   public TestTileController()
@@ -60,9 +61,9 @@
    System.out.println( "Controller called" );
 
 
-   String title = (String)tileContext.getAttribute("title");
+   String title = (String) tileContext.getAttribute("title").getValue();
    title += "- controller called";
-   tileContext.putAttribute( "title", title);
+   tileContext.putAttribute("title", new ComponentAttribute(title));
    }
 
 



Mime
View raw message