portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r471068 - in /portals/jetspeed-2/trunk: components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
Date Sat, 04 Nov 2006 00:23:20 GMT
Author: smilek
Date: Fri Nov  3 16:23:20 2006
New Revision: 471068

URL: http://svn.apache.org/viewvc?view=rev&rev=471068
Log:
added HeaderResource.addHeaderInfo(String text) and made HeaderResourceImpl.HeaderInfo inner
class support instances which has no element-name or attribute map

Modified:
    portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java

Modified: portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java?view=diff&rev=471068&r1=471067&r2=471068
==============================================================================
--- portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/header-resource/src/java/org/apache/jetspeed/headerresource/impl/HeaderResourceImpl.java
Fri Nov  3 16:23:20 2006
@@ -1048,8 +1048,23 @@
     /*
      * (non-Javadoc)
      * 
+     * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addHeaderInfo(java.lang.String)
+     */
+    public void addHeaderInfo(String text)
+    {
+        HeaderInfo headerInfo = new HeaderInfo(null, null, text);
+        if (!containsHeaderInfo(headerInfo))
+        {
+            Set headerInfoSet = getHeaderInfoSet();
+            headerInfoSet.add(headerInfo);
+        }
+    }
+    
+    /*
+     * (non-Javadoc)
+     * 
      * @see org.apache.jetspeed.headerresource.impl.HeaderResource#addHeaderInfo(java.lang.String,
-     *      java.util.Map)
+     *      java.util.Map,java.lang.String)
      */
     public void addHeaderInfo(String elementName, Map attributes, String text)
     {
@@ -1170,29 +1185,43 @@
         public String toString()
         {
             StringBuffer buf = new StringBuffer();
-            buf.append("<");
-            buf.append(getElementName());
-            buf.append(" ");
-
-            Set keySet = getAttributes().keySet();
-            for (Iterator ite = keySet.iterator(); ite.hasNext();)
-            {
-                String key = (String) ite.next();
-                buf.append(key);
-                buf.append("=\"");
-                buf.append((String) getAttributes().get(key));
-                buf.append("\" ");
-            }
+            
+            String elmtName = getElementName();
+            if ( elmtName != null && elmtName.length() > 0 )
+            {
+                buf.append("<");
+                buf.append(getElementName());
+                buf.append(" ");
 
-            if (getText() != null)
-            {
-                buf.append(">" + getText() + "</" + getElementName() + ">");
+                Map attrMap = getAttributes();
+                if ( attrMap != null )
+                {
+                    Set keySet = attrMap.keySet();
+                    for (Iterator ite = keySet.iterator(); ite.hasNext();)
+                    {
+                        String key = (String) ite.next();
+                        buf.append(key);
+                        buf.append("=\"");
+                        buf.append((String) attrMap.get(key));
+                        buf.append("\" ");
+                    }
+                }
+                if (getText() != null)
+                {
+                    buf.append(">" + getText() + "</" + getElementName() + ">");
+                }
+                else
+                {
+                    buf.append("/>");
+                }
             }
             else
             {
-                buf.append("/>");
+                if (getText() != null)
+                {
+                    buf.append( getText() );
+                }
             }
-
             return buf.toString();
         }
 
@@ -1201,9 +1230,9 @@
             if (o instanceof HeaderInfo)
             {
                 HeaderInfo headerInfo = (HeaderInfo) o;
-                if (headerInfo.getElementName().equalsIgnoreCase(getElementName())
+                if (compareString(headerInfo.getElementName(), getElementName())
                         && compareString(headerInfo.getText(), getText())
-                        && headerInfo.getAttributes().equals(getAttributes()))
+                        && compareAttributes(headerInfo.getAttributes(), getAttributes()))
                 {
                     return true;
                 }
@@ -1221,9 +1250,28 @@
                 }
 
             }
-            else
+            else if ( str1 != null )
             {
                 if (str0.equals(str1))
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+        
+        private boolean compareAttributes(Map attr0, Map attr1)
+        {
+            if (attr0 == null)
+            {
+                if (attr1 == null)
+                {
+                    return true;
+                }
+            }
+            else if ( attr1 != null )
+            {
+                if (attr0.equals(attr1))
                 {
                     return true;
                 }

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java?view=diff&rev=471068&r1=471067&r2=471068
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/headerresource/HeaderResource.java
Fri Nov  3 16:23:20 2006
@@ -52,9 +52,9 @@
     public final static String HEADER_CONFIG_TYPES = "header.types";
     public final static String HEADER_CONFIG_REQUIREDFLAG = "header.requiredflag";
     public final static String HEADER_CONFIG_DOJO = "dojo";
+    public final static String HEADER_CONFIG_DESKTOP = "desktop";
     
-    public final static String HEADER_INTERNAL_INCLUDED_NAMES = "header.internal.names";
 // not a configuration entry name
-    
+    public final static String HEADER_INTERNAL_INCLUDED_NAMES = "header.internal.names";
 // internal use - not a configuration entry name
     
     // header section predefined names
     public final static String HEADER_SECTION_BASE_TAG = "header.basetag";
@@ -73,6 +73,10 @@
     public final static String HEADER_SECTION_DESKTOP_STYLE_DESKTOPTHEME = "header.desktop.style.desktoptheme";
     public final static String HEADER_SECTION_DESKTOP_INIT = "header.desktop.init";
     
+    public final static String HEADER_INTERNAL_JETSPEED_VAR_NAME = "jetspeed";
+    public final static String HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME = "djConfig."
+ HEADER_INTERNAL_JETSPEED_VAR_NAME;  // internal use - not a configuration entry name
+    
+    
     /**
      * Output all content (that has not already been output)
      * 
@@ -315,6 +319,13 @@
      */
     public void addHeaderInfo(String elementName, Map attributes, String text);
 
+    /**
+     * Add text as-is to this instance.
+     * 
+     * @param text content
+     */
+    public void addHeaderInfo(String text);
+    
     /**
      * Convenient method to add &lt;script&gt; tag with defer option.
      * 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message