struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r471710 - in /struts/sandbox/trunk/tiles/tiles-core/src/main: java/org/apache/tiles/ java/org/apache/tiles/definition/ java/org/apache/tiles/definition/digester/ java/org/apache/tiles/impl/ resources/org/apache/tiles/resources/
Date Mon, 06 Nov 2006 12:30:23 GMT
Author: apetrelli
Date: Mon Nov  6 04:30:22 2006
New Revision: 471710

URL: http://svn.apache.org/viewvc?view=rev&rev=471710
Log:
SB-30
Removed support for "deprecated" DTD elements.

Removed:
    struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_1_1.dtd
    struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_1_2.dtd
Modified:
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinition.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinitionsImpl.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
    struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/package.html
    struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_2_0.dtd

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinition.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinition.java?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinition.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinition.java
Mon Nov  6 04:30:22 2006
@@ -51,9 +51,9 @@
     protected String name = null;
 
     /**
-     * Component / template path (URL).
+     * Template path.
      */
-    protected String path = null;
+    protected String template = null;
 
     /**
      * Attributes defined for the component.
@@ -79,7 +79,7 @@
      * Constructor.
      */
     public ComponentDefinition() {
-        attributes = new HashMap();
+        attributes = new HashMap<String, ComponentAttribute>();
     }
 
     /**
@@ -89,9 +89,10 @@
      * containing attributes.
      */
     public ComponentDefinition(ComponentDefinition definition) {
-        attributes = new HashMap(definition.getAttributes());
+        attributes = new HashMap<String, ComponentAttribute>(
+                definition.getAttributes());
         this.name = definition.getName();
-        this.path = definition.getPath();
+        this.template = definition.getTemplate();
         this.role = definition.getRole();
         this.preparer = definition.getPreparer();
     }
@@ -99,9 +100,10 @@
     /**
      * Constructor.
      */
-    public ComponentDefinition(String name, String path, Map attributes) {
+    public ComponentDefinition(String name, String template,
+            Map<String, ComponentAttribute> attributes) {
         this.name = name;
-        this.path = path;
+        this.template = template;
         this.attributes = attributes;
     }
 
@@ -124,59 +126,21 @@
     }
 
     /**
-     * Access method for the path property.
-     *
-     * @return The current value of the path property.
-     */
-    public String getPage() {
-        return path;
-    }
-
-    /**
-     * Sets the value of the path property.
-     *
-     * @param page the new value of the path property
-     */
-    public void setPage(String page) {
-        path = page;
-    }
-
-    /**
-     * Access method for the path property.
-     *
-     * @return the current value of the path property
-     */
-    public String getPath() {
-        return path;
-    }
-
-    /**
-     * Sets the value of the path property.
-     *
-     * @param aPath the new value of the path property
-     */
-    public void setPath(String aPath) {
-        path = aPath;
-    }
-
-    /**
      * Access method for the template property.
-     * Same as getPath()
      *
      * @return the current value of the template property
      */
     public String getTemplate() {
-        return path;
+        return template;
     }
 
     /**
      * Sets the value of the template property.
-     * Same as setPath()
      *
      * @param template the new value of the path property
      */
     public void setTemplate(String template) {
-        path = template;
+        this.template = template;
     }
 
     /**
@@ -241,37 +205,19 @@
      * @param content Attribute value
      */
     public void put(String name, Object content) {
-        put(name, content, false, null);
-    }
-
-    /**
-     * Put an attribute in template definition.
-     * Attribute can be used as content for tag get.
-     *
-     * @param name    Attribute name
-     * @param content Attribute value �
-     * @param direct  Determines how content is handled by get tag: true means content is
printed directly; false, the default, means content is included
-     */
-    public void put(String name, Object content, boolean direct) {
-        put(name, content, direct, null);
+        put(name, content, null);
     }
 
     /**
      * Put an attribute in template definition.
      * Attribute can be used as content for tag get.
-     *
-     * @param name    Attribute name
+     * @param name Attribute name
      * @param content Attribute value
-     * @param direct  Determines how content is handled by get tag: true means content is
printed directly; false, the default, means content is included
-     * @param role    Determine if content is used by get tag. If user is in role, content
is used.
+     * @param direct Determines how content is handled by get tag: true means content is
printed directly; false, the default, means content is included
+     * @param role Determine if content is used by get tag. If user is in role, content is
used.
      */
-    public void put(String name, Object content, boolean direct, String role) {
-        if (direct) { // direct String
-            put(name, content, ComponentAttribute.STRING, role);
-        } else {
-            put(name, content, ComponentAttribute.TEMPLATE, role);
-        }
-
+    public void put(String name, Object content, String role) {
+        put(name, content, null, role);
     }
 
     /**
@@ -297,8 +243,8 @@
     public String toString() {
         return "{name="
             + name
-            + ", path="
-            + path
+            + ", template="
+            + template
             + ", role="
             + role
             + ", preparerInstance="
@@ -376,31 +322,5 @@
      */
     public boolean isIsVisited() {
         return isVisited;
-    }
-
-
-    /**
-     * Overload this definition with passed child.
-     * All attributes from child are copied to this definition. Previous attributes with
-     * same name are disguarded.
-     * Special attribute 'path','role' and 'extends' are overloaded if defined in child.
-     *
-     * @param child Child used to overload this definition.
-     */
-    public void overload(ComponentDefinition child) {
-        if (child.getPath() != null) {
-            path = child.getPath();
-        }
-        if (child.getExtends() != null) {
-            inherit = child.getExtends();
-        }
-        if (child.getRole() != null) {
-            role = child.getRole();
-        }
-        if (child.getPreparer() != null) {
-            preparer = child.getPreparer();
-        }
-        // put all child attributes in parent.
-        attributes.putAll(child.getAttributes());
     }
 }

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinitionsImpl.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinitionsImpl.java?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinitionsImpl.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/ComponentDefinitionsImpl.java
Mon Nov  6 04:30:22 2006
@@ -46,14 +46,14 @@
     /**
      * The locale-specific set of definitions objects.
      */
-    private Map localeSpecificDefinitions;
+    private Map<Locale, Map> localeSpecificDefinitions;
 
     /**
      * Creates a new instance of ComponentDefinitionsImpl
      */
     public ComponentDefinitionsImpl() {
         baseDefinitions = new HashMap<String, ComponentDefinition>();
-        localeSpecificDefinitions = new HashMap();
+        localeSpecificDefinitions = new HashMap<Locale, Map>();
     }
 
     /**
@@ -145,7 +145,7 @@
      */
     public void reset() {
         this.baseDefinitions = new HashMap<String, ComponentDefinition>();
-        this.localeSpecificDefinitions = new HashMap();
+        this.localeSpecificDefinitions = new HashMap<Locale, Map>();
     }
 
     /**
@@ -262,7 +262,8 @@
 
     /**
      * Resolve inheritance.
-     * First, resolve parent's inheritance, then set path to the parent's path.
+     * First, resolve parent's inheritance, then set template to the parent's
+     * template.
      * Also copy attributes setted in parent, and not set in child
      * If instance doesn't extend anything, do nothing.
      *
@@ -302,7 +303,8 @@
 
     /**
      * Resolve locale-specific inheritance.
-     * First, resolve parent's inheritance, then set path to the parent's path.
+     * First, resolve parent's inheritance, then set template to the parent's
+     * template.
      * Also copy attributes setted in parent, and not set in child
      * If instance doesn't extend anything, do nothing.
      *
@@ -345,8 +347,8 @@
      * Overloads a child definition with a given parent.
      * All attributes present in child are kept. All missing attributes are
      * copied from the parent.
-     * Special attribute 'path','role' and 'extends' are overloaded in child if
-     * not defined
+     * Special attribute 'template','role' and 'extends' are overloaded in child
+     * if not defined
      *
      * @param parent The parent definition.
      * @param child  The child that will be overloaded.
@@ -360,9 +362,9 @@
             if (!child.getAttributes().containsKey(name))
                 child.put(name, parent.getAttribute(name));
         }
-        // Set path and role if not setted
-        if (child.getPath() == null)
-            child.setPath(parent.getPath());
+        // Set template and role if not setted
+        if (child.getTemplate() == null)
+            child.setTemplate(parent.getTemplate());
         if (child.getRole() == null)
             child.setRole(parent.getRole());
         if (child.getPreparer() == null) {

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
Mon Nov  6 04:30:22 2006
@@ -69,7 +69,7 @@
     /**
      * Stores ComponentDefinition objects.
      */
-    Map definitions;
+    Map<String, ComponentDefinition> definitions;
     /**
      * Should we use a validating XML parser to read the configuration file.
      * Default is <code>false</code>.
@@ -81,10 +81,6 @@
      * <strong>MUST</strong> be an even number of Strings in this list!
      */
     protected String registrations[] = {
-        "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN",
-        "/org/apache/tiles/resources/tiles-config_1_1.dtd",
-        "-//Apache Software Foundation//DTD Tiles Configuration 1.2//EN",
-        "/org/apache/tiles/resources/tiles-config_1_2.dtd",
         "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN",
         "/org/apache/tiles/resources/tiles-config_2_0.dtd"
     };
@@ -137,7 +133,7 @@
         // This is an instance variable instead of a local variable because
         // we want to be able to call the addDefinition method to populate it.
         // But we reset the Map here, which, of course, has threading implications.
-        definitions = new HashMap();
+        definitions = new HashMap<String, ComponentDefinition>();
 
         if (source == null) {
             // Perhaps we should throw an exception here.

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/impl/BasicTilesContainer.java
Mon Nov  6 04:30:22 2006
@@ -336,11 +336,11 @@
                 prepare(request, definition.getPreparer(), true);
             }
 
-            String dispatchPath = definition.getPath();
+            String dispatchPath = definition.getTemplate();
 
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Dispatching to definition path '" +
-                    definition.getPath() + " '");
+                    definition.getTemplate() + " '");
             }
             request.dispatch(dispatchPath);
 

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/package.html
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/package.html?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/package.html (original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/java/org/apache/tiles/package.html Mon
Nov  6 04:30:22 2006
@@ -326,7 +326,7 @@
   &lt;!-- ========================================================== --&gt;
   &lt;!-- Main page layout used as a root for other page definitions --&gt;
 
-  &lt;definition name=&amp;&amp;quot;site.mainLayout&amp;&amp;quot; path=&amp;&amp;quot;/layouts/classicLayout.jsp&amp;&amp;quot;&gt;
+  &lt;definition name=&amp;&amp;quot;site.mainLayout&amp;&amp;quot; template=&amp;&amp;quot;/layouts/classicLayout.jsp&amp;&amp;quot;&gt;
 	  &lt;put name=&amp;&amp;quot;title&amp;&amp;quot;  value=&amp;&amp;quot;Tiles
Blank Site&amp;&amp;quot; /&gt;
 	  &lt;put name=&amp;&amp;quot;header&amp;&amp;quot; value=&amp;&amp;quot;/tiles/common/header.jsp&amp;&amp;quot;
/&gt;
 	  &lt;put name=&amp;&amp;quot;menu&amp;&amp;quot;   value=&amp;&amp;quot;site.menu.bar&amp;&amp;quot;
/&gt;

Modified: struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_2_0.dtd
URL: http://svn.apache.org/viewvc/struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_2_0.dtd?view=diff&rev=471710&r1=471709&r2=471710
==============================================================================
--- struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_2_0.dtd
(original)
+++ struts/sandbox/trunk/tiles/tiles-core/src/main/resources/org/apache/tiles/resources/tiles-config_2_0.dtd
Mon Nov  6 04:30:22 2006
@@ -24,7 +24,7 @@
 <!-- A "ContentType" is the content type of an attribute passed to a tile
      component.
 -->
-<!ENTITY % ContentType "(string|page|template|definition)">
+<!ENTITY % ContentType "(string|template|definition)">
 
 <!-- A "ClassName" is the fully qualified name of a Java class that is
      instantiated to provide the functionality of the enclosing element.
@@ -93,17 +93,13 @@
 
      name            The unique identifier for this definition.
 
-     page            Same as path.
-
-     path            The context-relative path to the resource used as tiles to
-                     insert. This tiles will be inserted and a tiles context
-                     containing appropriate attributes will be available.
-
      role            Security role name that is allowed access to this definition
                      object. The definition is inserted only if the role name is
                      allowed.
 
-     template        Same as path. For compatibility with the template tag library.
+     template        The context-relative path to the resource used as tiles to
+                     insert. This tiles will be inserted and a tiles context
+                     containing appropriate attributes will be available.
 -->
 <!ELEMENT definition (icon?, display-name?, description?, put*, putList*)>
 <!ATTLIST definition       id               ID               #IMPLIED>
@@ -111,8 +107,6 @@
 <!ATTLIST definition       preparerUrl    %RequestPath;    #IMPLIED>
 <!ATTLIST definition       extends          %DefinitionName; #IMPLIED>
 <!ATTLIST definition       name             %DefinitionName; #REQUIRED>
-<!ATTLIST definition       page             %RequestPath;    #IMPLIED>
-<!ATTLIST definition       path             %RequestPath;    #IMPLIED>
 <!ATTLIST definition       role             CDATA            #IMPLIED>
 <!ATTLIST definition       template         %RequestPath;    #IMPLIED>
 
@@ -121,11 +115,6 @@
      specify the tiles attribute name and its value. The tiles value can be
      specified as an xml attribute, or in the body of the <put> tag.
 
-     content         Same as value. For compatibility with the template tag library.
-
-     direct          Same as type="string". For compatibility with the template
-                     tag library.
-
      name            The unique identifier for this put.
 
      type            The type of the value. Can be: string, page, template or definition.
@@ -138,8 +127,6 @@
 -->
 <!ELEMENT put (#PCDATA)>
 <!ATTLIST put              id               ID              #IMPLIED>
-<!ATTLIST put              content          CDATA           #IMPLIED>
-<!ATTLIST put              direct           %Boolean;       #IMPLIED>
 <!ATTLIST put              name             CDATA           #REQUIRED>
 <!ATTLIST put              type             %ContentType;   #IMPLIED>
 <!ATTLIST put              value            CDATA           #IMPLIED>
@@ -161,11 +148,6 @@
 <!-- The "add" element describes an element of a list. It is similar to the
      <put> element.
 
-     content         Same as value. For compatibility with the template tag library.
-
-     direct          Same as type="string". For compatibility with the template
-                     tag library.
-
      type            The type of the value. Can be: string, page, template or definition.
                      By default, no type is associated to a value. If a type is
                      associated, it will be used as a hint to process the value
@@ -176,8 +158,6 @@
 -->
 <!ELEMENT add (#PCDATA)>
 <!ATTLIST add              id               ID              #IMPLIED>
-<!ATTLIST add              content          CDATA           #IMPLIED>
-<!ATTLIST add              direct           %Boolean;       #IMPLIED>
 <!ATTLIST add              type             %ContentType;   #IMPLIED>
 <!ATTLIST add              value            CDATA           #IMPLIED>
 



Mime
View raw message