[OFBiz] SVN: r6519 - in trunk/framework/widget: dtd src/org/ofbiz/widget/form src/org/ofbiz/widget/html src/org/ofbiz/widget/screen src/org/ofbiz/widget/tree

jonesde@svn.ofbiz.org jonesde at svn.ofbiz.org
Tue Jan 17 02:17:32 CST 2006


Author: jonesde
Date: 2006-01-17 02:17:22 -0600 (Tue, 17 Jan 2006)
New Revision: 6519

Modified:
   trunk/framework/widget/dtd/widget-form.xsd
   trunk/framework/widget/dtd/widget-screen.xsd
   trunk/framework/widget/dtd/widget-tree.xsd
   trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
   trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
   trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
   trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java
   trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
   trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
   trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java
   trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
Log:
Applied some patches from Al Byers with some small changes like tabs to spaces formatting and had to implement the Java part of the new title field because that was missing, though not a big deal; these changes extend the content include screen widget functionality, adds some stuff for more JS events on forms, etc

Modified: trunk/framework/widget/dtd/widget-form.xsd
===================================================================
--- trunk/framework/widget/dtd/widget-form.xsd	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/dtd/widget-form.xsd	2006-01-17 08:17:22 UTC (rev 6519)
@@ -364,6 +364,12 @@
         <xs:attribute type="xs:string" name="use-when">
             <xs:annotation><xs:documentation>Used to specify a condition that must be true to use this field; the condition should be written using the Java syntax and can operate on values in the form context; if this is used the field will only be put on the field list, and not in the field map meaning that values for this field cannot be overridden.</xs:documentation></xs:annotation>
         </xs:attribute>
+        <xs:attribute type="xs:string" name="event">
+            <xs:annotation><xs:documentation>Used to specify javascript events that should be attached to fields.</xs:documentation></xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="action">
+            <xs:annotation><xs:documentation>Used to specify javascript actions that should be run based on events.</xs:documentation></xs:annotation>
+        </xs:attribute>
         <xs:attribute type="xs:string" name="id-name"/>
         <xs:attribute name="separate-column" default="false">
             <xs:simpleType>

Modified: trunk/framework/widget/dtd/widget-screen.xsd
===================================================================
--- trunk/framework/widget/dtd/widget-screen.xsd	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/dtd/widget-screen.xsd	2006-01-17 08:17:22 UTC (rev 6519)
@@ -823,6 +823,15 @@
                 </xs:restriction>
             </xs:simpleType>
         </xs:attribute>
+        <xs:attribute type="xs:string" name="width">
+            <xs:annotation><xs:documentation>Used if non-html content to specify width of iframe.</xs:documentation></xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="height">
+            <xs:annotation><xs:documentation>Used if non-html content to specify height of iframe.</xs:documentation></xs:annotation>
+        </xs:attribute>
+        <xs:attribute type="xs:string" name="border">
+            <xs:annotation><xs:documentation>Used if non-html content to specify border of iframe.</xs:documentation></xs:annotation>
+        </xs:attribute>
     </xs:attributeGroup>
     <xs:element name="decorator-screen" substitutionGroup="AllWidgets">
         <xs:annotation>

Modified: trunk/framework/widget/dtd/widget-tree.xsd
===================================================================
--- trunk/framework/widget/dtd/widget-tree.xsd	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/dtd/widget-tree.xsd	2006-01-17 08:17:22 UTC (rev 6519)
@@ -150,6 +150,7 @@
         <xs:attribute type="xs:string" name="id"/>
         <xs:attribute type="xs:string" name="style"/>
         <xs:attribute type="xs:string" name="name"/>
+        <xs:attribute type="xs:string" name="title"/>
         <xs:attribute type="xs:string" name="target"/>
         <xs:attribute type="xs:string" name="target-window"/>
         <xs:attribute type="xs:string" name="prefix"/>

Modified: trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -98,6 +98,8 @@
     protected String requiredFieldStyle;
     protected Integer position = null;
     protected String redWhen;
+    protected String event;
+    protected String action;
     protected FlexibleStringExpander useWhen;
 
     protected FieldInfo fieldInfo = null;
@@ -133,6 +135,8 @@
         this.tooltipStyle = fieldElement.getAttribute("tooltip-style");
         this.requiredFieldStyle = fieldElement.getAttribute("required-field-style");
         this.redWhen = fieldElement.getAttribute("red-when");
+        this.event = fieldElement.getAttribute("event");
+        this.action = fieldElement.getAttribute("action");
         this.setUseWhen(fieldElement.getAttribute("use-when"));
         this.idName = fieldElement.getAttribute("id-name");
         String sepColumns = fieldElement.getAttribute("separate-column");
@@ -250,6 +254,10 @@
             this.position = overrideFormField.position;
         if (UtilValidate.isNotEmpty(overrideFormField.redWhen))
             this.redWhen = overrideFormField.redWhen;
+        if (UtilValidate.isNotEmpty(overrideFormField.event))
+            this.event = overrideFormField.event;
+        if (UtilValidate.isNotEmpty(overrideFormField.action))
+            this.action = overrideFormField.action;
         if (overrideFormField.useWhen != null && !overrideFormField.useWhen.isEmpty())
             this.useWhen = overrideFormField.useWhen;
         if (overrideFormField.fieldInfo != null) {
@@ -759,7 +767,22 @@
         return redWhen;
     }
 
+
     /**
+     * @return
+     */
+    public String getEvent() {
+        return event;
+    }
+
+    /**
+     * @return
+     */
+    public String getAction() {
+        return action;
+    }
+
+/**
      * the widget/interaction part will be red if the date value is
      *  before-now (for ex. thruDate), after-now (for ex. fromDate), or by-name (if the
      *  field's name or entry-name or fromDate or thruDate the corresponding
@@ -1131,9 +1154,24 @@
         redWhen = string;
     }
 
+
     /**
      * @param string
      */
+    public void setEvent(String string) {
+        event = string;
+    }
+
+    /**
+     * @param string
+     */
+    public void setAction(String string) {
+        action = string;
+    }
+
+    /**
+     * @param string
+     */
     public void setServiceName(String string) {
         serviceName = string;
     }
@@ -2670,13 +2708,13 @@
     }
 
     public static class LookupField extends TextField {
-        protected String formName;
+        protected FlexibleStringExpander formName;
         protected String descriptionFieldName;
         protected String targetParameter;
         
         public LookupField(Element element, ModelFormField modelFormField) {
             super(element, modelFormField);
-            this.formName = element.getAttribute("target-form-name");
+            this.formName = new FlexibleStringExpander(element.getAttribute("target-form-name"));
             this.descriptionFieldName = element.getAttribute("description-field-name");
             this.targetParameter = element.getAttribute("target-parameter");
         }
@@ -2689,8 +2727,8 @@
             formStringRenderer.renderLookupField(buffer, context, this);
         }
 
-        public String getFormName() {
-            return this.formName;
+        public String getFormName(Map context) {
+            return this.formName.expandString(context);
         }
 
         public List getTargetParameterList() {
@@ -2705,7 +2743,7 @@
         }
 
         public void setFormName(String str) {
-            this.formName = str;
+            this.formName = new FlexibleStringExpander(str);
         }
         
         public String getDescriptionFieldName() {

Modified: trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -254,6 +254,16 @@
             buffer.append('"');
         }
 
+        String event = modelFormField.getEvent();
+        String action = modelFormField.getAction();
+        if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) {
+            buffer.append(" ");
+            buffer.append(event);
+            buffer.append("=\"");
+            buffer.append(action);
+            buffer.append('"');
+        }
+
         buffer.append("/>");
         
         this.addAstericks(buffer, context, modelFormField);
@@ -407,6 +417,9 @@
         ModelFormField modelFormField = dropDownField.getModelFormField();
         ModelForm modelForm = modelFormField.getModelForm();
 
+        String event = modelFormField.getEvent();
+        String action = modelFormField.getAction();
+
         buffer.append("<select");
 
         String className = modelFormField.getWidgetStyle();
@@ -442,6 +455,14 @@
         }
 
 
+        if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) {
+            buffer.append(" ");
+            buffer.append(event);
+            buffer.append("=\"");
+            buffer.append(action);
+            buffer.append('"');
+        }
+
         buffer.append(" size=\"1\">");
 
         String currentValue = modelFormField.getEntry(context);
@@ -595,6 +616,8 @@
         ModelForm modelForm = modelFormField.getModelForm();
         List allOptionValues = radioField.getAllOptionValues(context, modelForm.getDelegator());
         String currentValue = modelFormField.getEntry(context);
+        String event = modelFormField.getEvent();
+        String action = modelFormField.getAction();
 
         // list out all options according to the option list
         Iterator optionValueIter = allOptionValues.iterator();
@@ -625,8 +648,18 @@
             buffer.append('"');
             buffer.append(" value=\"");
             buffer.append(optionValue.getKey());
-            buffer.append("\"/>");
+            buffer.append("\"");
 
+            if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) {
+                buffer.append(" ");
+                buffer.append(event);
+                buffer.append("=\"");
+                buffer.append(action);
+                buffer.append('"');
+            }
+            
+            buffer.append("/>");
+
             buffer.append(optionValue.getDescription());
             buffer.append("</div>");
         }
@@ -1694,7 +1727,7 @@
             buffer.append(modelFormField.getParameterName(context));
             buffer.append(", '");
         }
-        buffer.append(lookupField.getFormName());
+        buffer.append(lookupField.getFormName(context));
         buffer.append("'");
         List targetParameterList = lookupField.getTargetParameterList();
         if (targetParameterList.size() > 0) {
@@ -1968,6 +2001,16 @@
             buffer.append('"');
         }
 
+        String event = modelFormField.getEvent();
+        String action = modelFormField.getAction();
+        if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) {
+            buffer.append(" ");
+            buffer.append(event);
+            buffer.append("=\"");
+            buffer.append(action);
+            buffer.append('"');
+        }
+
         buffer.append("/>");
 
         this.makeHyperlinkString(buffer, imageField.getSubHyperlink(), context);

Modified: trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -23,6 +23,7 @@
  */
 package org.ofbiz.widget.html;
 
+import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.Writer;
 import java.sql.Timestamp;
@@ -38,11 +39,15 @@
 import org.ofbiz.base.util.GeneralException;
 import org.ofbiz.base.util.UtilDateTime;
 import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.webapp.control.RequestHandler;
 import org.ofbiz.webapp.taglib.ContentUrlTag;
+import org.ofbiz.webapp.view.ViewHandlerException;
 import org.ofbiz.widget.WidgetContentWorker;
 import org.ofbiz.widget.screen.ModelScreenWidget;
 import org.ofbiz.widget.screen.ScreenStringRenderer;
@@ -367,7 +372,31 @@
         }
     }
 
+    public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException {
+    	
+    	String dataResourceId = content.getDataResourceId();
+    	String urlString = "ViewSimpleContent?dataResourceId=" + dataResourceId;
+    	
+    	String width = content.getWidth();
+    	String widthString=" width=\"" + width + "\"";
+    	String height = content.getHeight();
+    	String heightString=" height=\"" + height + "\"";
+    	String border = content.getBorder();
+    	String borderString = (UtilValidate.isNotEmpty(border)) ? " border=\"" + border + "\"" : "";
+    	
+        HttpServletRequest request = (HttpServletRequest) context.get("request");
+        HttpServletResponse response = (HttpServletResponse) context.get("response");
+        if (request != null && response != null) {
+        	ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
+        	RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
+        	String fullUrlString = rh.makeLink(request, response, urlString, true, false, false);
+        	String linkString = "<iframe src=\"" + fullUrlString + "\" " + widthString + heightString + borderString + " />";
+        	writer.write(linkString);
+        }
+    	
+    }
 
+
     public void renderSubContentBegin(Writer writer, Map context, ModelScreenWidget.SubContent content) throws IOException {
 
         String editRequest = content.getEditRequest(context);

Modified: trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -223,6 +223,12 @@
             writer.write(name);
             writer.write("\"");
         }
+        String title = link.getTitle(context);
+        if (UtilValidate.isNotEmpty(title)) {
+            writer.write(" title=\"");
+            writer.write(title);
+            writer.write("\"");
+        }        
         String targetWindow = link.getTargetWindow(context);
         if (UtilValidate.isNotEmpty(targetWindow)) {
             writer.write(" target=\"");

Modified: trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -42,6 +42,7 @@
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.base.util.UtilXml;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.collections.MapStack;
 import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.widget.form.FormFactory;
@@ -56,6 +57,9 @@
 import org.ofbiz.widget.tree.ModelTree;
 import org.ofbiz.widget.tree.TreeFactory;
 import org.ofbiz.widget.tree.TreeStringRenderer;
+import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.GenericEntityException;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
@@ -814,6 +818,10 @@
         protected FlexibleStringExpander editContainerStyle;
         protected FlexibleStringExpander enableEditName;
         protected boolean xmlEscape = false;
+        protected String dataResourceId;
+        protected String width;
+        protected String height;
+        protected String border;
         
         public Content(ModelScreen modelScreen, Element subContentElement) {
             super(modelScreen, subContentElement);
@@ -824,6 +832,11 @@
             this.editContainerStyle = new FlexibleStringExpander(subContentElement.getAttribute("edit-container-style"));
             this.enableEditName = new FlexibleStringExpander(subContentElement.getAttribute("enable-edit-name"));
             this.xmlEscape = "true".equals(subContentElement.getAttribute("xml-escape"));
+            this.width = subContentElement.getAttribute("width");
+            if (UtilValidate.isEmpty(this.width)) this.width="60%";
+            this.height = subContentElement.getAttribute("height");
+            if (UtilValidate.isEmpty(this.height)) this.width="400px";
+            this.border = subContentElement.getAttribute("border");
             return;
         }
 
@@ -839,19 +852,45 @@
                 }
                 
                 // This is an important step to make sure that the current contentId is in the context
-                // as temples that contain "subcontent" elements will expect to find the master
+                // as templates that contain "subcontent" elements will expect to find the master
                 // contentId in the context as "contentId".
                 ((MapStack) context).push();
                 context.put("contentId", expandedContentId);
                 
-                screenStringRenderer.renderContentBegin(writer, context, this);
-                screenStringRenderer.renderContentBody(writer, context, this);
-                screenStringRenderer.renderContentEnd(writer, context, this);
+                GenericDelegator delegator = (GenericDelegator) context.get("delegator");
+                GenericValue content = null;
+                if (UtilValidate.isNotEmpty(expandedContentId)) {
+                	content = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", expandedContentId));
+                }
+                
+                GenericValue dataResource = null;
+                this.dataResourceId = content.getString("dataResourceId");
+                if (UtilValidate.isNotEmpty(dataResourceId)) {
+                	dataResource = delegator.findByPrimaryKeyCache("Content", UtilMisc.toMap("contentId", expandedContentId));
+                }
+                
+                String mimeTypeId = null;
+                if (dataResource != null) {
+                	mimeTypeId = dataResource.getString("mimeTypeId");
+                }
+                
+                if (UtilValidate.isNotEmpty(mimeTypeId) 
+                		&& ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0) ) {
+                	screenStringRenderer.renderContentFrame(writer, context, this);
+                } else {
+                	screenStringRenderer.renderContentBegin(writer, context, this);
+                	screenStringRenderer.renderContentBody(writer, context, this);
+                	screenStringRenderer.renderContentEnd(writer, context, this);
+                }
                 ((MapStack) context).pop();
             } catch (IOException e) {
                 String errMsg = "Error rendering content with contentId [" + getContentId(context) + "]: " + e.toString();
                 Debug.logError(e, errMsg, module);
                 throw new RuntimeException(errMsg);
+            } catch (GenericEntityException e) {
+                String errMsg = "Error obtaining content with contentId [" + getContentId(context) + "]: " + e.toString();
+                Debug.logError(e, errMsg, module);
+                throw new RuntimeException(errMsg);
             }
 
         }
@@ -880,6 +919,22 @@
             // may want to expand this a bit more
             return "<content content-id=\"" + this.contentId.getOriginal() + "\" xml-escape=\"" + this.xmlEscape + "\"/>";
         }
+        
+        public String getDataResourceId() {
+            return this.dataResourceId;
+        }
+        
+        public String getWidth() {
+            return this.width;
+        }
+        
+        public String getHeight() {
+            return this.height;
+        }
+        
+        public String getBorder() {
+            return this.border;
+        }
     }
 
     public static class SubContent extends ModelScreenWidget {

Modified: trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -334,6 +334,10 @@
         context.push();
     }
 
+    public Map getContext() {
+    	return context;
+    }
+    
     public void populateContextForService(DispatchContext dctx, Map serviceContext) {
         this.populateBasicContext(serviceContext, dctx.getDelegator(), dctx.getDispatcher(), dctx.getSecurity(), 
                 (Locale) serviceContext.get("locale"), (GenericValue) serviceContext.get("userLogin"));

Modified: trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -50,5 +50,7 @@
     public void renderLabel(Writer writer, Map context, ModelScreenWidget.Label label) throws IOException;
     public void renderLink(Writer writer, Map context, ModelScreenWidget.Link link) throws IOException;
     public void renderImage(Writer writer, Map context, ModelScreenWidget.Image image) throws IOException;
+
+    public void renderContentFrame(Writer writer, Map context, ModelScreenWidget.Content content) throws IOException;
 }
 

Modified: trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java	2006-01-17 07:56:52 UTC (rev 6518)
+++ trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java	2006-01-17 08:17:22 UTC (rev 6519)
@@ -111,7 +111,7 @@
         this.trailNameExdr = new FlexibleStringExpander(UtilFormatOut.checkEmpty(treeElement.getAttribute("trail-name"), "trail"));
         this.delegator = delegator;
         this.dispatcher = dispatcher;
-        setDefaultEntityName( treeElement.getAttribute("entity-name") );
+        setDefaultEntityName(treeElement.getAttribute("entity-name"));
         try {
             openDepth = Integer.parseInt(treeElement.getAttribute("open-depth"));
         } catch(NumberFormatException e) {
@@ -328,7 +328,7 @@
             this.wrapStyleExdr = new FlexibleStringExpander(nodeElement.getAttribute("wrap-style"));
             this.renderStyle = nodeElement.getAttribute("render-style");
             this.entryName = UtilFormatOut.checkEmpty(nodeElement.getAttribute("entry-name"), null); 
-            setEntityName( nodeElement.getAttribute("entity-name") );
+            setEntityName(nodeElement.getAttribute("entity-name"));
             if (this.pkName == null || nodeElement.hasAttribute("join-field-name"))
                 this.pkName = nodeElement.getAttribute("join-field-name");
     
@@ -417,7 +417,7 @@
                 }
                 modelTree.currentNodeTrail.add(id);
                 context.put("currentNodeTrail", modelTree.currentNodeTrail);
-                String currentNodeTrailPiped = StringUtil.join( modelTree.currentNodeTrail, "|");
+                String currentNodeTrailPiped = StringUtil.join(modelTree.currentNodeTrail, "|");
                 context.put("currentNodeTrailPiped", currentNodeTrailPiped);
                 treeStringRenderer.renderNodeBegin(writer, context, this, depth, isLast);
                 //if (Debug.infoOn()) Debug.logInfo(" context:" +
@@ -565,9 +565,9 @@
                      Debug.logError(e, module); 
                     throw new RuntimeException(e.getMessage());
                  }
-             } else if (nodeCount == null ) {
+             } else if (nodeCount == null) {
                  getChildren(context);
-                if (subNodeValues != null )
+                if (subNodeValues != null)
                     nodeCount = new Long(subNodeValues.size());
              }
              
@@ -641,36 +641,33 @@
         public boolean isFollowTrail() {
             boolean isFollowTrail = false;
             String rStyle = getRenderStyle();
-            if (rStyle != null && (rStyle.equals("follow-trail") || rStyle.equals("show-peers") || rStyle.equals("follow-trail")))
+            if (rStyle != null && (rStyle.equals("follow-trail") || rStyle.equals("show-peers") || rStyle.equals("follow-trail"))) {
                 isFollowTrail = true;
+            }
             
             return isFollowTrail;
         }
     
         public boolean showPeers(int currentDepth) {
-        
             int trailSize = 0;
             List trail = modelTree.getTrailList();
             int openDepth = modelTree.getOpenDepth();
             int postTrailOpenDepth = modelTree.getPostTrailOpenDepth();
-            if (trail != null)
-                trailSize = trail.size();
+            if (trail != null) trailSize = trail.size();
                 
             boolean showPeers = false;
             String rStyle = getRenderStyle();
-            if (rStyle == null )
+            if (rStyle == null) {
                 showPeers = true;
-            else if (!isFollowTrail() )
+            } else if (!isFollowTrail()) {
                 showPeers = true;
-            else if ((currentDepth < trailSize) && (rStyle != null) &&  (rStyle.equals("show-peers") || rStyle.equals("expand-collapse")))
+            } else if ((currentDepth < trailSize) && (rStyle != null) &&  (rStyle.equals("show-peers") || rStyle.equals("expand-collapse"))) {
                 showPeers = true;
-            else if (openDepth >= currentDepth)
+            } else if (openDepth >= currentDepth) {
                 showPeers = true;
-            else {
-                
+            } else {
                 int depthAfterTrail = currentDepth - trailSize;
-                if (depthAfterTrail >= 0 && depthAfterTrail <= postTrailOpenDepth)
-                    showPeers = true;
+                if (depthAfterTrail >= 0 && depthAfterTrail <= postTrailOpenDepth) showPeers = true;
             }
             
             return showPeers;
@@ -682,8 +679,9 @@
 
         public String getWrapStyle(Map context) {
             String val = this.wrapStyleExdr.expandString(context);
-            if (UtilValidate.isEmpty(val))
+            if (UtilValidate.isEmpty(val)) {
                 val = this.modelTree.getWrapStyle(context);
+            }
             return val;
         }
     
@@ -788,7 +786,7 @@
             protected FlexibleStringExpander idExdr;
             protected FlexibleStringExpander styleExdr;
             
-            public Label( Element labelElement) {
+            public Label(Element labelElement) {
     
                 // put the text attribute first, then the pcdata under the element, if both are there of course
                 String textAttr = UtilFormatOut.checkNull(labelElement.getAttribute("text"));
@@ -831,6 +829,7 @@
             protected FlexibleStringExpander targetWindowExdr;
             protected FlexibleStringExpander prefixExdr;
             protected FlexibleStringExpander nameExdr;
+            protected FlexibleStringExpander titleExdr;
             protected Image image;
             protected String urlMode = "intra-app";
             protected boolean fullPath = false;
@@ -849,9 +848,10 @@
                 setSecure(null);
                 setEncode(null);
                 setName(null);
+                setTitle(null);
             }
 
-            public Link( Element linkElement) {
+            public Link(Element linkElement) {
     
                 setText(linkElement.getAttribute("text"));
                 setId(linkElement.getAttribute("id"));
@@ -864,6 +864,7 @@
                 setSecure(linkElement.getAttribute("secure"));
                 setEncode(linkElement.getAttribute("encode"));
                 setName(linkElement.getAttribute("name"));
+                setTitle(linkElement.getAttribute("title"));
                 Element imageElement = UtilXml.firstChildElement(linkElement, "image");
                 if (imageElement != null) {
                     this.image = new Image(imageElement);
@@ -896,6 +897,9 @@
             public String getName(Map context) {
                 return this.nameExdr.expandString(context);
             }
+            public String getTitle(Map context) {
+                return this.titleExdr.expandString(context);
+            }
         
             public String getTarget(Map context) {
                 return this.targetExdr.expandString(context);
@@ -929,33 +933,36 @@
                 return this.image;
             }
 
-            public void setText( String val ) {
+            public void setText(String val) {
                 String textAttr = UtilFormatOut.checkNull(val);
                 this.textExdr = new FlexibleStringExpander(textAttr);
             }
-            public void setId( String val ) {
+            public void setId(String val) {
                 this.idExdr = new FlexibleStringExpander(val);
             }
-            public void setStyle( String val ) {
+            public void setStyle(String val) {
                 this.styleExdr = new FlexibleStringExpander(val);
             }
-            public void setName( String val ) {
+            public void setName(String val) {
                 this.nameExdr = new FlexibleStringExpander(val);
             }
-            public void setTarget( String val ) {
+            public void setTitle(String val) {
+                this.titleExdr = new FlexibleStringExpander(val);
+            }
+            public void setTarget(String val) {
                 this.targetExdr = new FlexibleStringExpander(val);
             }
-            public void setTargetWindow( String val ) {
+            public void setTargetWindow(String val) {
                 this.targetWindowExdr = new FlexibleStringExpander(val);
             }
-            public void setPrefix( String val ) {
+            public void setPrefix(String val) {
                 this.prefixExdr = new FlexibleStringExpander(val);
             }
-            public void setUrlMode( String val ) {
+            public void setUrlMode(String val) {
                 if (UtilValidate.isNotEmpty(val))
                     this.urlMode = val;
             }
-            public void setFullPath( String val ) {
+            public void setFullPath(String val) {
                 String sFullPath = val;
                 if (sFullPath != null && sFullPath.equalsIgnoreCase("true"))
                     this.fullPath = true;
@@ -963,7 +970,7 @@
                     this.fullPath = false;
             }
 
-            public void setSecure( String val ) {
+            public void setSecure(String val) {
                 String sSecure = val;
                 if (sSecure != null && sSecure.equalsIgnoreCase("true"))
                     this.secure = true;
@@ -971,14 +978,14 @@
                     this.secure = false;
             }
 
-            public void setEncode( String val ) {
+            public void setEncode(String val) {
                 String sEncode = val;
                 if (sEncode != null && sEncode.equalsIgnoreCase("true"))
                     this.encode = true;
                 else
                     this.encode = false;
             }
-            public void setImage( Image img ) {
+            public void setImage(Image img) {
                 this.image = img;
             }
                 
@@ -1005,7 +1012,7 @@
                 setUrlMode(null);
             }
 
-            public Image( Element imageElement) {
+            public Image(Element imageElement) {
     
                 setSrc(imageElement.getAttribute("src"));
                 setId(imageElement.getAttribute("id"));
@@ -1055,26 +1062,26 @@
                 return this.urlMode;
             }
             
-            public void setSrc( String val ) {
+            public void setSrc(String val) {
                 String textAttr = UtilFormatOut.checkNull(val);
                 this.srcExdr = new FlexibleStringExpander(textAttr);
             }
-            public void setId( String val ) {
+            public void setId(String val) {
                 this.idExdr = new FlexibleStringExpander(val);
             }
-            public void setStyle( String val ) {
+            public void setStyle(String val) {
                 this.styleExdr = new FlexibleStringExpander(val);
             }
-            public void setWidth( String val ) {
+            public void setWidth(String val) {
                 this.widthExdr = new FlexibleStringExpander(val);
             }
-            public void setHeight( String val ) {
+            public void setHeight(String val) {
                 this.heightExdr = new FlexibleStringExpander(val);
             }
-            public void setBorder( String val ) {
+            public void setBorder(String val) {
                 this.borderExdr = new FlexibleStringExpander(val);
             }
-            public void setUrlMode( String val ) {
+            public void setUrlMode(String val) {
                 if (UtilValidate.isEmpty(val))
                     this.urlMode = "content";
                 else



More information about the Svn mailing list