Author: jacopoc
Date: Sat Mar 3 00:14:07 2007 New Revision: 514099 URL: http://svn.apache.org/viewvc?view=rev&rev=514099 Log: Applied patch from Adrian Crum (OFBIZ-671) to refactor form, menu, tree widget styles management (now mostly all the styles are defined externally using css): this is still a work in progress. Modified: ofbiz/trunk/applications/content/widget/CommonScreens.xml ofbiz/trunk/applications/content/widget/content/ContentMenus.xml ofbiz/trunk/applications/marketing/widget/CommonScreens.xml ofbiz/trunk/applications/marketing/widget/MarketingMenus.xml ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml ofbiz/trunk/framework/widget/dtd/widget-form.xsd ofbiz/trunk/framework/widget/dtd/widget-menu.xsd ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeStringRenderer.java Modified: ofbiz/trunk/applications/content/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/CommonScreens.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/content/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/content/widget/CommonScreens.xml Sat Mar 3 00:14:07 2007 @@ -35,7 +35,6 @@ <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> --> <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> --> <set field="activeApp" value="contentmgr" global="true"/> - <set field="applicationTitle" from-field="uiLabelMap.ContentContentManagerApplication" global="true"/> <set field="applicationMenuName" value="ContentAppBar" global="true"/> <set field="applicationMenuLocation" value="component://content/widget/content/ContentMenus.xml" global="true"/> </actions> Modified: ofbiz/trunk/applications/content/widget/content/ContentMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/widget/content/ContentMenus.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/content/widget/content/ContentMenus.xml (original) +++ ofbiz/trunk/applications/content/widget/content/ContentMenus.xml Sat Mar 3 00:14:07 2007 @@ -19,10 +19,9 @@ --> <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-menu.xsd"> - <menu name="ContentAppBar" default-menu-item-name="main" default-selected-style="headerButtonLeftSelected" - default-tooltip-style="tabletext" default-widget-style="headerButtonLeft" - default-align-style="col" menu-container-style="row" fill-style="col-fill" - orientation="horizontal" type="simple" selected-menuitem-context-field-name="headerItem"> + <menu name="ContentAppBar" default-menu-item-name="main" default-selected-style="selected" + default-tooltip-style="tooltip" id="app-navigation" title="${uiLabelMap.ContentContentManagerApplication}" + type="simple" selected-menuitem-context-field-name="headerItem"> <menu-item name="main" title="${uiLabelMap.ContentMain}"><link target="main"/></menu-item> <menu-item name="websites" title="${uiLabelMap.ContentWebSites}"><link target="FindWebSite"/></menu-item> <menu-item name="survey" title="${uiLabelMap.ContentSurvey}"><link target="FindSurvey"/></menu-item> Modified: ofbiz/trunk/applications/marketing/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/CommonScreens.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/marketing/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/marketing/widget/CommonScreens.xml Sat Mar 3 00:14:07 2007 @@ -34,7 +34,7 @@ <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> --> <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> --> <set field="activeApp" value="marketing" global="true"/> - <set field="applicationTitle" from-field="uiLabelMap.MarketingManagerApplication" global="true"/> +<!-- <set field="applicationTitle" from-field="uiLabelMap.MarketingManagerApplication" global="true"/> --> <set field="applicationMenuName" value="MarketingAppBar" global="true"/> <set field="applicationMenuLocation" value="component://marketing/widget/MarketingMenus.xml" global="true"/> </actions> Modified: ofbiz/trunk/applications/marketing/widget/MarketingMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/MarketingMenus.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/marketing/widget/MarketingMenus.xml (original) +++ ofbiz/trunk/applications/marketing/widget/MarketingMenus.xml Sat Mar 3 00:14:07 2007 @@ -18,9 +18,9 @@ under the License. --> <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-menu.xsd"> - <menu name="MarketingAppBar" default-menu-item-name="main" default-selected-style="headerButtonLeftSelected" - default-title-style="tabButton" default-tooltip-style="tabletext" default-widget-style="headerButtonLeft" - default-align-style="col" menu-container-style="row" fill-style="col-fill" orientation="horizontal" type="simple"> + <menu name="MarketingAppBar" default-menu-item-name="main" default-selected-style="selected" + id="app-navigation" default-tooltip-style="tooltip" + type="simple" title="${uiLabelMap.MarketingManagerApplication}"> <menu-item name="main" title="${uiLabelMap.MarketingMainPage}"><link target="main"/></menu-item> <menu-item name="DataSource" title="${uiLabelMap.DataSource}"><link target="FindDataSource"/></menu-item> <menu-item name="Campaign" title="${uiLabelMap.MarketingCampaign}"><link target="FindMarketingCampaign"/></menu-item> @@ -28,15 +28,15 @@ <menu-item name="Segment" title="${uiLabelMap.Segment}"><link target="FindSegmentGroup"/></menu-item> <menu-item name="ContactList" title="${uiLabelMap.ContactList}"><link target="FindContactLists"/></menu-item> - <menu-item name="Logout" title="Logout" align-style="col-right" widget-style="headerButtonRight" selected-style="headerButtonRightSelected"> + <menu-item name="Logout" title="Logout" align-style="col-right" selected-style="selected"> <condition><not><if-empty field-name="userLogin"/></not></condition> <link target="logout"/> </menu-item> - <menu-item name="Login" title="Login" align-style="col-right" widget-style="headerButtonRight" selected-style="headerButtonRightSelected"> + <menu-item name="Login" title="Login" align-style="col-right" selected-style="selected"> <condition><if-empty field-name="userLogin"/></condition> <link target="${checkLoginUrl}"/> </menu-item> - <menu-item name="Reports" title="${uiLabelMap.MarketingReports}" align-style="col-right" widget-style="headerButtonRight"><link target="MarketingReport"/></menu-item> + <menu-item name="Reports" title="${uiLabelMap.MarketingReports}" align-style="col-right"><link target="MarketingReport"/></menu-item> </menu> </menus> Modified: ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/CommonScreens.xml Sat Mar 3 00:14:07 2007 @@ -41,7 +41,6 @@ <!-- <set field="layoutSettings.headerMiddleBackgroundUrl" value="" global="true"/> --> <!-- <set field="layoutSettings.headerRightBackgroundUrl" value="" global="true"/> --> <set field="activeApp" value="workeffort" global="true"/> - <set field="applicationTitle" from-field="uiLabelMap.WorkEffortWorkEffortManagerApplication" global="true"/> <set field="applicationMenuName" value="WorkEffortAppBar" global="true"/> <set field="applicationMenuLocation" value="component://workeffort/widget/WorkEffortMenus.xml" global="true"/> </actions> Modified: ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml (original) +++ ofbiz/trunk/applications/workeffort/widget/WorkEffortMenus.xml Sat Mar 3 00:14:07 2007 @@ -20,10 +20,9 @@ <menus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/widget-menu.xsd"> - <menu name="WorkEffortAppBar" default-menu-item-name="task" default-selected-style="headerButtonLeftSelected" - default-tooltip-style="tabletext" default-widget-style="headerButtonLeft" - default-align-style="col" menu-container-style="row" fill-style="col-fill" - orientation="horizontal" type="simple" selected-menuitem-context-field-name="headerItem"> + <menu name="WorkEffortAppBar" default-menu-item-name="task" default-selected-style="selected" + default-tooltip-style="tooltip" id="app-navigation" type="simple" selected-menuitem-context-field-name="headerItem" + title="${uiLabelMap.WorkEffortWorkEffortManagerApplication}"> <menu-item name="task" title="${uiLabelMap.WorkEffortTaskList}"><link target="mytasks"/></menu-item> <menu-item name="calendar" title="${uiLabelMap.WorkEffortCalendar}"><link target="day"/></menu-item> <menu-item name="mytime" title="${uiLabelMap.TimesheetMyTime}"><link target="MyTimesheets"/></menu-item> Modified: ofbiz/trunk/framework/widget/dtd/widget-form.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-form.xsd?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-form.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-form.xsd Sat Mar 3 00:14:07 2007 @@ -72,6 +72,9 @@ </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute type="xs:string" name="id"/> + <xs:attribute type="xs:string" name="style"/> + <xs:attribute type="xs:string" name="focus-field-name"/> <xs:attribute type="xs:string" name="title"/> <xs:attribute type="xs:string" name="tooltip"/> <xs:attribute type="xs:string" name="list-name"> Modified: ofbiz/trunk/framework/widget/dtd/widget-menu.xsd URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/dtd/widget-menu.xsd?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/dtd/widget-menu.xsd (original) +++ ofbiz/trunk/framework/widget/dtd/widget-menu.xsd Sat Mar 3 00:14:07 2007 @@ -44,6 +44,7 @@ </xs:restriction> </xs:simpleType> </xs:attribute> + <xs:attribute type="xs:string" name="id"/> <xs:attribute type="xs:string" name="title"/> <xs:attribute type="xs:string" name="tooltip"/> <xs:attribute type="xs:string" name="default-entity-name"/> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sat Mar 3 00:14:07 2007 @@ -66,6 +66,9 @@ protected String type; protected FlexibleStringExpander target; protected String targetType; + protected String containerId; + protected String containerStyle; + protected String focusFieldName; protected String title; protected String tooltip; protected String listName; @@ -213,6 +216,9 @@ if (parent != null) { this.type = parent.type; this.target = parent.target; + this.containerId = parent.containerId; + this.containerStyle = parent.containerStyle; + this.focusFieldName = parent.focusFieldName; this.title = parent.title; this.tooltip = parent.tooltip; this.listName = parent.listName; @@ -263,6 +269,15 @@ if (this.targetWindowExdr == null || formElement.hasAttribute("target-window")) { setTargetWindow(formElement.getAttribute("target-window")); } + if (this.containerId == null || formElement.hasAttribute("id")) { + this.containerId = formElement.getAttribute("id"); + } + if (this.containerStyle == null || formElement.hasAttribute("style")) { + this.containerStyle = formElement.getAttribute("style"); + } + if (this.focusFieldName == null || formElement.hasAttribute("focus-field-name")) { + this.focusFieldName = formElement.getAttribute("focus-field-name"); + } if (this.title == null || formElement.hasAttribute("title")) { this.title = formElement.getAttribute("title"); } @@ -644,7 +659,7 @@ * value of the name attribute) * @param formStringRenderer An implementation of the FormStringRenderer * interface that is responsible for the actual text generation for - * different form elements; implementing you own makes it possible to + * different form elements; implementing your own makes it possible to * use the same form definitions for many types of form UIs */ public void renderFormString(StringBuffer buffer, Map context, FormStringRenderer formStringRenderer) { @@ -1556,6 +1571,27 @@ /** * @return */ + public String getContainerId() { + return this.containerId; + } + + /** + * @return + */ + public String getContainerStyle() { + return this.containerStyle; + } + + /** + * @return + */ + public String getfocusFieldName() { + return this.focusFieldName; + } + + /** + * @return + */ public String getTitle() { return this.title; } @@ -1718,6 +1754,20 @@ */ public void setTarget(String string) { this.target = new FlexibleStringExpander(string); + } + + /** + * @param string + */ + public void setContainerId(String string) { + this.containerId = string; + } + + /** + * @param string + */ + public void setfocusFieldName(String string) { + this.focusFieldName = string; } /** Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Sat Mar 3 00:14:07 2007 @@ -103,16 +103,16 @@ // render the tooltip, in other methods too String tooltip = modelFormField.getTooltip(context); if (UtilValidate.isNotEmpty(tooltip)) { - buffer.append("<span"); + buffer.append("<span class=\""); String tooltipStyle = modelFormField.getTooltipStyle(); if (UtilValidate.isNotEmpty(tooltipStyle)) { - buffer.append(" class=\""); buffer.append(tooltipStyle); - buffer.append("\""); + } else { + buffer.append("tooltip"); } - buffer.append("> -["); + buffer.append("\">"); buffer.append(tooltip); - buffer.append("]- </span>"); + buffer.append("</span>"); } } @@ -128,28 +128,44 @@ } } + public void appendClassNames(StringBuffer buffer, Map context, ModelFormField modelFormField) { + String className = modelFormField.getWidgetStyle(); + if (UtilValidate.isNotEmpty(className) || modelFormField.shouldBeRed(context)) { + buffer.append(" class=\""); + buffer.append(className); + // add a style of red if redWhen is true + if (modelFormField.shouldBeRed(context)) { + buffer.append(" alert"); + } + buffer.append('"'); + } + } + /* (non-Javadoc) * @see org.ofbiz.widget.form.FormStringRenderer#renderDisplayField(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField.DisplayField) */ public void renderDisplayField(StringBuffer buffer, Map context, DisplayField displayField) { ModelFormField modelFormField = displayField.getModelFormField(); - buffer.append("<span"); + StringBuffer str = new StringBuffer(); - if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { - buffer.append(" class=\""); - buffer.append(modelFormField.getWidgetStyle()); - buffer.append("\""); + if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle()) || modelFormField.shouldBeRed(context)) { + str.append("<span class=\""); + str.append(modelFormField.getWidgetStyle()); + // add a style of red if this is a date/time field and redWhen is true + if (modelFormField.shouldBeRed(context)) { + str.append(" alert"); + } + str.append("\">"); } - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); + if (str.length() > 0) { + buffer.append(str); } - - buffer.append(">"); buffer.append(displayField.getDescription(context)); - buffer.append("</span>"); + if (str.length() > 0) { + buffer.append("</span>"); + } if (displayField instanceof DisplayEntityField) { this.makeHyperlinkString(buffer, ((DisplayEntityField) displayField).getSubHyperlink(), context); @@ -157,7 +173,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -173,7 +189,7 @@ hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context)); this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } public void makeHyperlinkString(StringBuffer buffer, ModelFormField.SubHyperlink subHyperlink, Map context) { @@ -205,17 +221,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -264,7 +270,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -275,14 +281,7 @@ buffer.append("<textarea"); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } else { - buffer.append(" class=\"textAreaBox\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -338,7 +337,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -360,17 +359,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); if ("time-dropdown".equals(dateTimeField.getInputMethod())) { @@ -405,8 +394,9 @@ String value = modelFormField.getEntry(context, dateTimeField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { - if(value.length() > maxlength) + if(value.length() > maxlength) { value = value.substring(0, maxlength); + } buffer.append(" value=\""); buffer.append(value); buffer.append('"'); @@ -443,9 +433,9 @@ } buffer.append(modelFormField.getModelForm().getCurrentFormName(context)); buffer.append('.'); - if ("time-dropdown".equals(dateTimeField.getInputMethod())) + if ("time-dropdown".equals(dateTimeField.getInputMethod())) { buffer.append(UtilHttp.makeCompositeParam(paramName, "date")); - else { + } else { buffer.append(paramName); } buffer.append(",'"); @@ -463,6 +453,7 @@ // if we have an input method of time-dropdown, then render two dropdowns if ("time-dropdown".equals(dateTimeField.getInputMethod())) { + String className = modelFormField.getWidgetStyle(); String classString = (className != null ? " class=\"" + className + "\" " : ""); boolean isTwelveHour = "12".equals(dateTimeField.getClock()); @@ -535,7 +526,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -550,12 +541,7 @@ buffer.append("<select"); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -578,8 +564,6 @@ buffer.append("."); buffer.append(otherFieldName); buffer.append(")\" "); - /* - */ } @@ -692,7 +676,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -705,19 +689,9 @@ // never used: ModelForm modelForm = modelFormField.getModelForm(); String currentValue = modelFormField.getEntry(context); - buffer.append("<span"); - - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - buffer.append(">"); + buffer.append("<input type=\"checkbox\""); - buffer.append("<input type=\""); - buffer.append("checkbox"); - buffer.append('"'); + appendClassNames(buffer, context, modelFormField); // if current value should be selected in the list, select it if ("Y".equals(currentValue) || "T".equals(currentValue)) { @@ -729,11 +703,9 @@ buffer.append(" value=\"Y\"/>"); // any description by it? - buffer.append("</span>"); - this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -751,19 +723,13 @@ Iterator optionValueIter = allOptionValues.iterator(); while (optionValueIter.hasNext()) { ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next(); - String className = modelFormField.getWidgetStyle(); + buffer.append("<div"); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - buffer.append(">"); - buffer.append("<input type=\""); - buffer.append("radio"); - buffer.append('"'); + appendClassNames(buffer, context, modelFormField); + buffer.append("><input type=\"radio\""); + // if current value should be selected in the list, select it String noCurrentSelectedKey = radioField.getNoCurrentSelectedKey(context); if (UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey())) { @@ -794,7 +760,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -810,12 +776,7 @@ if ("text-link".equals(submitField.getButtonType())) { buffer.append("<a"); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" href=\"javascript:document."); buffer.append(modelForm.getCurrentFormName(context)); @@ -827,12 +788,7 @@ } else if ("image".equals(submitField.getButtonType())) { buffer.append("<input type=\"image\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -867,12 +823,7 @@ buffer.append("<input type=\"submit\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -904,7 +855,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -915,12 +866,7 @@ buffer.append("<input type=\"reset\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -937,7 +883,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -964,7 +910,7 @@ buffer.append("/>"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -982,17 +928,17 @@ String titleText = UtilHttp.encodeAmpersands(tempTitleText); if (UtilValidate.isNotEmpty(titleText)) { - buffer.append("<span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append("<span class=\""); buffer.append(modelFormField.getTitleStyle()); - buffer.append("\""); + buffer.append("\">"); } - buffer.append(">"); renderHyperlinkTitle(buffer, context, modelFormField, titleText); - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { + buffer.append("</span>"); + } - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } } @@ -1002,7 +948,6 @@ public void renderSingleFormFieldTitle(StringBuffer buffer, Map context, ModelFormField modelFormField) { boolean requiredField = modelFormField.getRequiredField(); if (requiredField) { - buffer.append("<span"); String requiredStyle = modelFormField.getRequiredFieldStyle(); if (UtilValidate.isEmpty(requiredStyle)) { @@ -1010,15 +955,16 @@ } if (UtilValidate.isNotEmpty(requiredStyle)) { - buffer.append(" class=\""); + buffer.append("<span class=\""); buffer.append(requiredStyle); - buffer.append("\""); + buffer.append("\">"); } - buffer.append(">"); renderHyperlinkTitle(buffer, context, modelFormField, modelFormField.getTitle(context)); - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(requiredStyle)) { + buffer.append("</span>"); + } - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } else { renderFieldTitle(buffer, context, modelFormField); } @@ -1028,6 +974,8 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormOpen(StringBuffer buffer, Map context, ModelForm modelForm) { + buffer.append("<!-- begin form widget -->"); + this.appendWhitespace(buffer); buffer.append("<form method=\"post\" "); String targ = modelForm.getTarget(context); String targetType = modelForm.getTargetType(); @@ -1052,9 +1000,25 @@ buffer.append("\""); } + String containerId = modelForm.getContainerId(); + if (UtilValidate.isNotEmpty(containerId)) { + buffer.append(" id=\""); + buffer.append(containerId); + buffer.append("\""); + } + + buffer.append(" class=\""); + String containerStyle = modelForm.getContainerStyle(); + if (UtilValidate.isNotEmpty(containerStyle)) { + buffer.append(containerStyle); + } else { + buffer.append("basic-form"); + } + buffer.append("\""); + buffer.append(" name=\""); buffer.append(modelForm.getCurrentFormName(context)); - buffer.append("\" style=\"margin: 0;\">"); + buffer.append("\">"); this.appendWhitespace(buffer); } @@ -1064,6 +1028,22 @@ */ public void renderFormClose(StringBuffer buffer, Map context, ModelForm modelForm) { buffer.append("</form>"); + String focusFieldName = modelForm.getfocusFieldName(); + if (UtilValidate.isNotEmpty(focusFieldName)) { + this.appendWhitespace(buffer); + buffer.append("<script language=\"JavaScript\" type=\"text/javascript\">"); + this.appendWhitespace(buffer); + buffer.append("<!--//"); + this.appendWhitespace(buffer); + buffer.append("document." + modelForm.getCurrentFormName(context) + "."); + buffer.append(focusFieldName + ".focus();"); + this.appendWhitespace(buffer); + buffer.append("//-->"); + this.appendWhitespace(buffer); + buffer.append("</script>"); + } + this.appendWhitespace(buffer); + buffer.append("<!-- end form widget -->"); this.appendWhitespace(buffer); } @@ -1106,20 +1086,24 @@ } buffer.append("</form>"); + this.appendWhitespace(buffer); + buffer.append("<!-- end form widget -->"); this.appendWhitespace(buffer); } public void renderFormatListWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) { + buffer.append("<!-- begin form widget -->"); + this.appendWhitespace(buffer); if(UtilValidate.isNotEmpty(modelForm.getDefaultTableStyle())) { - buffer.append("<table"); + buffer.append(" <table"); buffer.append(" class=\""); buffer.append(modelForm.getDefaultTableStyle()); buffer.append("\""); - buffer.append(">"); + buffer.append("cellspacing=\"0\">"); } else { - buffer.append("<table border=\"1\" cellpadding=\"2\" cellspacing=\"0\" class=\"calendarTable\">"); + buffer.append(" <table cellspacing=\"0\" class=\"basic-table dark-grid\">"); // DEJ 20050101 removed the width=\"100%\", doesn't look very good with CSS float: left based side "columns" } @@ -1127,7 +1111,7 @@ } public void renderFormatListWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</table>"); + buffer.append(" </table>"); this.appendWhitespace(buffer); String queryString = null; @@ -1143,20 +1127,23 @@ } context.put("_QBESTRING_", queryString); this.renderNextPrev(buffer, context, modelForm); + buffer.append("<!-- end form widget -->"); + this.appendWhitespace(buffer); } /* (non-Javadoc) * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatHeaderRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("<tr"); + buffer.append(" <tr"); String headerStyle = modelForm.getHeaderRowStyle(); + buffer.append(" class=\""); if (UtilValidate.isNotEmpty(headerStyle)) { - buffer.append(" class=\""); buffer.append(headerStyle); - buffer.append("\""); + } else { + buffer.append("header-row"); } - buffer.append(">"); + buffer.append("\">"); this.appendWhitespace(buffer); } @@ -1164,7 +1151,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatHeaderRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</tr>"); + buffer.append(" </tr>"); this.appendWhitespace(buffer); } @@ -1173,7 +1160,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) */ public void renderFormatHeaderRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) { - buffer.append("<td"); + buffer.append(" <td"); String areaStyle = modelFormField.getTitleAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { buffer.append(" class=\""); @@ -1181,7 +1168,7 @@ buffer.append("\""); } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1193,7 +1180,7 @@ } public void renderFormatHeaderRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("<td align=\"center\""); + buffer.append(" <td"); String areaStyle = modelForm.getFormTitleAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { buffer.append(" class=\""); @@ -1201,7 +1188,7 @@ buffer.append("\""); } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1216,21 +1203,21 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatHeaderRowFormCellTitleSeparator(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, boolean) */ public void renderFormatHeaderRowFormCellTitleSeparator(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) { - buffer.append("<span"); String titleStyle = modelFormField.getTitleStyle(); if (UtilValidate.isNotEmpty(titleStyle)) { - buffer.append(" class=\""); + buffer.append("<span class=\""); buffer.append(titleStyle); - buffer.append("\""); + buffer.append("\">"); } - buffer.append(">"); if (isLast) { buffer.append(" - "); } else { buffer.append(" - "); } - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(titleStyle)) { + buffer.append("</span>"); + } } /* (non-Javadoc) @@ -1239,7 +1226,7 @@ public void renderFormatItemRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { Integer itemIndex = (Integer)context.get("itemIndex"); - buffer.append("<tr"); + buffer.append(" <tr"); if (itemIndex!=null) { if (itemIndex.intValue()%2==0) { @@ -1266,7 +1253,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatItemRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</tr>"); + buffer.append(" </tr>"); this.appendWhitespace(buffer); } @@ -1275,7 +1262,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm, org.ofbiz.widget.form.ModelFormField) */ public void renderFormatItemRowCellOpen(StringBuffer buffer, Map context, ModelForm modelForm, ModelFormField modelFormField) { - buffer.append("<td"); + buffer.append(" <td"); String areaStyle = modelFormField.getWidgetAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { buffer.append(" class=\""); @@ -1283,7 +1270,7 @@ buffer.append("\""); } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1298,7 +1285,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatItemRowFormCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatItemRowFormCellOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("<td align=\"center\""); + buffer.append(" <td"); String areaStyle = modelForm.getFormWidgetAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { buffer.append(" class=\""); @@ -1306,7 +1293,7 @@ buffer.append("\""); } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1318,13 +1305,13 @@ } public void renderFormatSingleWrapperOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\">"); + buffer.append(" <table cellspacing=\"0\">"); this.appendWhitespace(buffer); } public void renderFormatSingleWrapperClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</table>"); + buffer.append(" </table>"); this.appendWhitespace(buffer); } @@ -1333,7 +1320,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatFieldRowOpen(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("<tr>"); + buffer.append(" <tr>"); this.appendWhitespace(buffer); } @@ -1342,7 +1329,7 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelForm) */ public void renderFormatFieldRowClose(StringBuffer buffer, Map context, ModelForm modelForm) { - buffer.append("</tr>"); + buffer.append(" </tr>"); this.appendWhitespace(buffer); } @@ -1351,15 +1338,17 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowTitleCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ public void renderFormatFieldRowTitleCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField) { - buffer.append("<td width=\"20%\" align=\"right\""); + buffer.append(" <td"); String areaStyle = modelFormField.getTitleAreaStyle(); if (UtilValidate.isNotEmpty(areaStyle)) { buffer.append(" class=\""); buffer.append(areaStyle); buffer.append("\""); + } else { + buffer.append(" class=\"label\""); } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1374,22 +1363,24 @@ * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowSpacerCell(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField) */ public void renderFormatFieldRowSpacerCell(StringBuffer buffer, Map context, ModelFormField modelFormField) { - buffer.append("<td> </td>"); + // Embedded styling - bad idea + //buffer.append("<td> </td>"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) * @see org.ofbiz.widget.form.FormStringRenderer#renderFormatFieldRowWidgetCellOpen(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.form.ModelFormField, int) */ public void renderFormatFieldRowWidgetCellOpen(StringBuffer buffer, Map context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) { - buffer.append("<td width=\""); - if (nextPositionInRow != null || modelFormField.getPosition() > 1) { - buffer.append("30"); - } else { - buffer.append("80"); - } - buffer.append("%\" align=\"left\""); +// buffer.append("<td width=\""); +// if (nextPositionInRow != null || modelFormField.getPosition() > 1) { +// buffer.append("30"); +// } else { +// buffer.append("80"); +// } +// buffer.append("%\""); + buffer.append(" <td"); if (positionSpan > 0) { buffer.append(" colspan=\""); // do a span of 1 for this column, plus 3 columns for each spanned @@ -1405,7 +1396,7 @@ } buffer.append(">"); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1447,17 +1438,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1483,24 +1464,24 @@ buffer.append("/>"); - buffer.append(" <span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append(" <span class=\""); buffer.append(modelFormField.getTitleStyle()); - buffer.append('"'); + buffer.append("\">"); } - buffer.append('>'); buffer.append(" <input type=\"checkbox\" name=\""); buffer.append(modelFormField.getParameterName(context)); buffer.append("_ic\" value=\"Y\"" + (ignCase ? " checked=\"checked\"" : "") + "/>"); buffer.append(ignoreCase); - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { + buffer.append("</span>"); + } this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1519,17 +1500,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1555,9 +1526,8 @@ buffer.append("/>"); - buffer.append(" <span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append(" <span class=\""); buffer.append(modelFormField.getTitleStyle()); buffer.append('"'); } @@ -1577,17 +1547,7 @@ buffer.append("<input type=\"text\""); - className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1612,13 +1572,11 @@ buffer.append("/>"); - buffer.append(" <span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append(" <span class=\""); buffer.append(modelFormField.getTitleStyle()); - buffer.append('"'); + buffer.append("\">"); } - buffer.append('>'); buffer.append(" <select name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1627,11 +1585,13 @@ buffer.append("<option value=\"lessThanEqualTo\">" + opLessThanEquals + "</option>"); buffer.append("</select>"); - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { + buffer.append("</span>"); + } this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1659,17 +1619,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1700,8 +1650,9 @@ String value = modelFormField.getEntry(context, dateFindField.getDefaultValue(context)); if (UtilValidate.isNotEmpty(value)) { - if(value.length() > maxlength) + if (value.length() > maxlength) { value = value.substring(0, maxlength); + } buffer.append(" value=\""); buffer.append(value); buffer.append('"'); @@ -1745,13 +1696,11 @@ buffer.append("\"/></a>"); } - buffer.append(" <span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append(" <span class=\""); buffer.append(modelFormField.getTitleStyle()); - buffer.append('"'); + buffer.append("\">"); } - buffer.append('>'); buffer.append(" <select name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1762,22 +1711,15 @@ buffer.append("<option value=\"greaterThan\">" + opGreaterThan + "</option>"); buffer.append("</select>"); - buffer.append(" </span>"); + if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { + buffer.append(" </span>"); + } buffer.append(" <br/> "); buffer.append("<input type=\"text\""); - className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1789,8 +1731,9 @@ value = modelFormField.getEntry(context); if (UtilValidate.isNotEmpty(value)) { - if(value.length() > maxlength) + if (value.length() > maxlength) { value = value.substring(0, maxlength); + } buffer.append(" value=\""); buffer.append(value); buffer.append('"'); @@ -1829,13 +1772,11 @@ buffer.append("\"/></a>"); } - buffer.append(" <span"); if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { - buffer.append(" class=\""); + buffer.append(" <span class=\""); buffer.append(modelFormField.getTitleStyle()); - buffer.append('"'); + buffer.append("\">"); } - buffer.append('>'); buffer.append(" <select name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1846,11 +1787,13 @@ buffer.append("<option value=\"empty\">" + opIsEmpty + "</option>"); buffer.append("</select>"); - buffer.append("</span>"); + if (UtilValidate.isNotEmpty(modelFormField.getTitleStyle())) { + buffer.append("</span>"); + } this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -1861,17 +1804,7 @@ buffer.append("<input type=\"text\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -1937,7 +1870,7 @@ this.makeHyperlinkString(buffer, lookupField.getSubHyperlink(), context); this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } public void renderNextPrev(StringBuffer buffer, Map context, ModelForm modelForm) { @@ -1988,7 +1921,7 @@ String paginateAnchor = modelForm.getPaginateTargetAnchor(); if (paginateAnchor != null) anchor = "#" + paginateAnchor; - buffer.append("<table border=\"0\" cellpadding=\"2\">\n"); + buffer.append(" <table border=\"0\" cellpadding=\"2\">\n"); buffer.append(" <tr>\n"); buffer.append(" <td align=\"right\">\n"); buffer.append(" <b>\n"); @@ -2023,9 +1956,9 @@ } buffer.append(" </b>\n"); - buffer.append(" </td>\n"); + buffer.append(" </td>\n"); buffer.append(" </tr>\n"); - buffer.append("</table>\n"); + buffer.append(" </table>\n"); this.appendWhitespace(buffer); } @@ -2038,17 +1971,7 @@ buffer.append("<input type=\"file\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -2078,7 +2001,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -2089,17 +2012,7 @@ buffer.append("<input type=\"password\""); - String className = modelFormField.getWidgetStyle(); - if (UtilValidate.isNotEmpty(className)) { - buffer.append(" class=\""); - buffer.append(className); - buffer.append('"'); - } - - // add a style of red if this is a date/time field and redWhen is true - if (modelFormField.shouldBeRed(context)) { - buffer.append(" style=\"color: red;\""); - } + appendClassNames(buffer, context, modelFormField); buffer.append(" name=\""); buffer.append(modelFormField.getParameterName(context)); @@ -2138,7 +2051,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } /* (non-Javadoc) @@ -2192,7 +2105,7 @@ this.appendTooltip(buffer, context, modelFormField); - this.appendWhitespace(buffer); + //this.appendWhitespace(buffer); } public void renderFieldGroupOpen(StringBuffer buffer, Map context, ModelForm.FieldGroup fieldGroup) { @@ -2212,8 +2125,9 @@ } } + // TODO: Remove embedded styling public void renderBanner(StringBuffer buffer, Map context, ModelForm.Banner banner) { - buffer.append("<table width=\"100%\"><tr>"); + buffer.append(" <table width=\"100%\"> <tr>"); String style = banner.getStyle(context); String leftStyle = banner.getLeftTextStyle(context); if (UtilValidate.isEmpty(leftStyle)) leftStyle = style; @@ -2222,7 +2136,7 @@ String leftText = banner.getLeftText(context); if (UtilValidate.isNotEmpty(leftText)) { - buffer.append("<td align=\"left\">"); + buffer.append(" <td align=\"left\">"); if (UtilValidate.isNotEmpty(leftStyle)) { buffer.append("<div"); buffer.append(" class=\""); @@ -2239,7 +2153,7 @@ String text = banner.getText(context); if (UtilValidate.isNotEmpty(text)) { - buffer.append("<td align=\"center\">"); + buffer.append(" <td align=\"center\">"); if (UtilValidate.isNotEmpty(style)) { buffer.append("<div"); buffer.append(" class=\""); @@ -2256,7 +2170,7 @@ String rightText = banner.getRightText(context); if (UtilValidate.isNotEmpty(rightText)) { - buffer.append("<td align=\"right\">"); + buffer.append(" <td align=\"right\">"); if (UtilValidate.isNotEmpty(rightStyle)) { buffer.append("<div"); buffer.append(" class=\""); @@ -2270,7 +2184,7 @@ } buffer.append("</td>"); } - buffer.append("</tr></table>"); + buffer.append("</tr> </table>"); } /** Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Sat Mar 3 00:14:07 2007 @@ -87,9 +87,9 @@ RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); // make and append the link String s = rh.makeLink(this.request, this.response, location); - if (s.indexOf("null") >= 0) { - //if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl(3), url: " + s, ""); - } + if (s.indexOf("null") >= 0) { + //if (Debug.infoOn()) Debug.logInfo("in appendOfbizUrl(3), url: " + s, ""); + } buffer.append(s); } @@ -106,7 +106,7 @@ if (ctx == null) { throw new RuntimeException("ctx is null. buffer=" + buffer.toString() + " location:" + location); } - //if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is NOT null(2)", ""); + //if (Debug.infoOn()) Debug.logInfo("in appendContentUrl, ctx is NOT null(2)", ""); this.request.setAttribute("servletContext", ctx); } GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator"); @@ -118,19 +118,19 @@ } public void appendTooltip(StringBuffer buffer, Map context, ModelMenuItem modelMenuItem) { - // render the tooltip, in other methods too + // render the tooltip String tooltip = modelMenuItem.getTooltip(context); if (UtilValidate.isNotEmpty(tooltip)) { - buffer.append("<span"); + buffer.append("<span class=\""); String tooltipStyle = modelMenuItem.getTooltipStyle(); if (UtilValidate.isNotEmpty(tooltipStyle)) { - buffer.append(" class=\""); buffer.append(tooltipStyle); - buffer.append("\""); + } else { + buffer.append("tooltip"); } - buffer.append("> -["); + buffer.append("\""); buffer.append(tooltip); - buffer.append("]- </span>"); + buffer.append("</span>"); } } @@ -154,17 +154,32 @@ if (hideThisItem) return; - - String style = menuItem.getAlignStyle(); - if (UtilValidate.isNotEmpty(style)) { - String orientation = menuItem.getModelMenu().getOrientation(); - if (orientation.equalsIgnoreCase("vertical")) style += "-vert"; - String align = menuItem.getAlign(); - if (align.equalsIgnoreCase("right")) style += "-right"; - - buffer.append("<div class=\"" + style + "\">"); + String style = null; + + if (menuItem.isSelected(context)) { + style = menuItem.getSelectedStyle(); + if (UtilValidate.isEmpty(style)) { + style = "selected"; + } + } + + if (menuItem.getDisabled()) { + style = menuItem.getDisabledTitleStyle(); } + buffer.append(" <li"); + String alignStyle = menuItem.getAlignStyle(); + if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(alignStyle)) { + buffer.append(" class=\""); + if (UtilValidate.isNotEmpty(style)) { + buffer.append(style + " "); + } + if (UtilValidate.isNotEmpty(alignStyle)) { + buffer.append(alignStyle); + } + buffer.append("\""); + } + buffer.append(">"); Link link = menuItem.getLink(); //if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,""); @@ -172,10 +187,7 @@ renderLink(buffer, context, link); } - if (UtilValidate.isNotEmpty(style)) { - // only render the close tag if we rendered the open - buffer.append("</div>"); - } + buffer.append("</li>"); this.appendWhitespace(buffer); } @@ -198,13 +210,13 @@ return disabled; } - +/* public String buildDivStr(ModelMenuItem menuItem, Map context) { String divStr = ""; divStr = menuItem.getTitle(context); return divStr; } - +*/ public void renderMenuOpen(StringBuffer buffer, Map context, ModelMenu modelMenu) { if (!userLoginIdHasChanged) { @@ -212,13 +224,32 @@ } //Debug.logInfo("in HtmlMenuRenderer, userLoginIdHasChanged:" + userLoginIdHasChanged,""); + buffer.append("<!-- begin menu widget -->"); + this.appendWhitespace(buffer); + buffer.append("<div"); + String menuId = modelMenu.getId(); + if (UtilValidate.isNotEmpty(menuId)) { + buffer.append(" id=\"" + menuId + "\""); + } else { + // TODO: Remove else after UI refactor - allow both id and style + String menuContainerStyle = modelMenu.getMenuContainerStyle(context); + if (UtilValidate.isNotEmpty(menuContainerStyle)) { + buffer.append(" class=\"" + menuContainerStyle + "\""); + } + } String menuWidth = modelMenu.getMenuWidth(); - String menuContainerStyle = modelMenu.getMenuContainerStyle(context); - String widthStr = ""; + // TODO: Eliminate embedded styling after refactor if (UtilValidate.isNotEmpty(menuWidth)) { - widthStr = " style=\"width:" + menuWidth + ";\""; + buffer.append(" style=\"width:" + menuWidth + ";\""); } - buffer.append("<div class=\"" + menuContainerStyle + "\"" + widthStr + ">"); + buffer.append(">"); + String menuTitle = modelMenu.getTitle(context); + if (UtilValidate.isNotEmpty(menuTitle)) { + this.appendWhitespace(buffer); + buffer.append(" <h2>" + menuTitle + "</h2>"); + } + this.appendWhitespace(buffer); + buffer.append(" <ul>"); this.appendWhitespace(buffer); } @@ -227,14 +258,19 @@ * @see org.ofbiz.widget.menu.MenuStringRenderer#renderMenuClose(java.lang.StringBuffer, java.util.Map, org.ofbiz.widget.menu.ModelMenu) */ public void renderMenuClose(StringBuffer buffer, Map context, ModelMenu modelMenu) { - - String fillStyle = modelMenu.getFillStyle(); - if (UtilValidate.isNotEmpty(fillStyle)) { - buffer.append("<div class=\"" + fillStyle + "\"> </div>"); - } + String fillStyle = modelMenu.getFillStyle(); + if (UtilValidate.isNotEmpty(fillStyle)) { + buffer.append("<div class=\"" + fillStyle + "\"> </div>"); + } //String menuContainerStyle = modelMenu.getMenuContainerStyle(context); + buffer.append(" </ul>"); + this.appendWhitespace(buffer); + buffer.append(" <br class=\"clear\" />"); + this.appendWhitespace(buffer); buffer.append("</div>"); this.appendWhitespace(buffer); + buffer.append("<!-- end menu widget -->"); + this.appendWhitespace(buffer); userLoginIdHasChanged = userLoginIdHasChanged(); GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); @@ -281,21 +317,16 @@ } public boolean isHideIfSelected( ModelMenuItem menuItem) { - ModelMenu menu = menuItem.getModelMenu(); String currentMenuItemName = menu.getCurrentMenuItemName(); String currentItemName = menuItem.getName(); Boolean hideIfSelected = menuItem.getHideIfSelected(); //Debug.logInfo("in HtmlMenuRenderer, currentMenuItemName:" + currentMenuItemName + " currentItemName:" + currentItemName + " hideIfSelected:" + hideIfSelected,""); - if (hideIfSelected != null && hideIfSelected.booleanValue() && currentMenuItemName != null && currentMenuItemName.equals(currentItemName)) - return true; - else - return false; + return (hideIfSelected != null && hideIfSelected.booleanValue() && currentMenuItemName != null && currentMenuItemName.equals(currentItemName)); } public boolean userLoginIdHasChanged() { - boolean hasChanged = false; GenericValue userLogin = (GenericValue)request.getSession().getAttribute("userLogin"); userLoginIdAtPermGrant = getUserLoginIdAtPermGrant(); @@ -327,7 +358,6 @@ public String getTitle(ModelMenuItem menuItem, Map context) { - String title = null; title = menuItem.getTitle(context); return title; @@ -344,6 +374,7 @@ } ModelMenuItem menuItem = link.getLinkMenuItem(); +/* boolean isSelected = menuItem.isSelected(context); String style = null; @@ -367,6 +398,7 @@ buffer.append(style); buffer.append("\""); } +*/ String name = link.getName(context); if (UtilValidate.isNotEmpty(name)) { buffer.append(" name=\""); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Sat Mar 3 00:14:07 2007 @@ -39,7 +39,7 @@ /** - * Widget Library - HTML Form Renderer implementation + * Widget Library - HTML Tree Renderer implementation */ public class HtmlTreeRenderer implements TreeStringRenderer { @@ -49,11 +49,11 @@ public HtmlTreeRenderer() {} public static String buildPathString(ModelTree modelTree, int depth) { - StringBuffer buf = new StringBuffer(); + StringBuffer buf = new StringBuffer(); for (int i=1; i <= depth; i++) { int idx = modelTree.getNodeIndexAtDepth(i); - buf.append("."); - buf.append(Integer.toString(idx + 1)); + buf.append("."); + buf.append(Integer.toString(idx + 1)); } return buf.toString(); } @@ -67,23 +67,24 @@ context.put("staticNodeTrailPiped", staticNodeTrailPiped); context.put("nodePathString", pathString); context.put("depth", Integer.toString(depth)); - String style = node.getWrapStyle(context); - if (UtilValidate.isNotEmpty(style)) { - writer.write("<div"); - writer.write(" class=\""); - writer.write(style); - writer.write("\""); - writer.write(">"); + if (node.isRootNode()) { + appendWhitespace(writer); + writer.write("<!-- begin tree widget -->"); + appendWhitespace(writer); + writer.write("<ul class=\"basic-tree\">"); + } else { + appendWhitespace(writer); + writer.write(" <li>"); } String pkName = node.getPkName(); String entityId = null; String entryName = node.getEntryName(); - if (UtilValidate.isNotEmpty(entryName)) { - Map map = (Map)context.get(entryName); + if (UtilValidate.isNotEmpty(entryName)) { + Map map = (Map)context.get(entryName); entityId = (String)map.get(pkName); } else { - entityId = (String) context.get(pkName); + entityId = (String) context.get(pkName); } boolean hasChildren = node.hasChildren(context); //Debug.logInfo("HtmlTreeExpandCollapseRenderer, hasChildren(1):" + hasChildren, module); @@ -101,40 +102,43 @@ ModelTree.ModelNode.Image expandCollapseImage = new ModelTree.ModelNode.Image(); expandCollapseImage.setBorder("0"); ModelTree.ModelNode.Link expandCollapseLink = new ModelTree.ModelNode.Link(); - String expandCollapseStyle = UtilFormatOut.checkEmpty(node.getExpandCollapseStyle(), "expandcollapse"); - expandCollapseLink.setStyle(expandCollapseStyle); - expandCollapseLink.setImage(expandCollapseImage); //String currentNodeTrailCsv = (String)context.get("currentNodeTrailCsv"); int openDepth = node.getModelTree().getOpenDepth(); if (depth >= openDepth && (targetEntityId == null || !targetEntityId.equals(entityId))) { // Not on the trail if( node.showPeers(depth)) { - context.put("processChildren", Boolean.FALSE); - //expandCollapseLink.setText(" + "); - currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); - context.put("currentNodeTrailPiped", currentNodeTrailPiped); - //context.put("currentNodeTrailCsv", currentNodeTrailCsv); - expandCollapseImage.setSrc("/images/expand.gif"); - String target = node.getModelTree().getExpandCollapseRequest(context); - String trailName = node.getModelTree().getTrailName(context); - if (target.indexOf("?") < 0) target += "?"; - else target += "&"; - target += trailName + "=" + currentNodeTrailPiped; + context.put("processChildren", Boolean.FALSE); + //expandCollapseLink.setText(" + "); + currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); + context.put("currentNodeTrailPiped", currentNodeTrailPiped); + //context.put("currentNodeTrailCsv", currentNodeTrailCsv); + expandCollapseLink.setStyle("collapsed"); + expandCollapseLink.setText(" "); + String target = node.getModelTree().getExpandCollapseRequest(context); + String trailName = node.getModelTree().getTrailName(context); + if (target.indexOf("?") < 0) { + target += "?"; + } else { + target += "&"; + } + target += trailName + "=" + currentNodeTrailPiped; target += "#" + staticNodeTrailPiped; - //expandCollapseLink.setTarget("/ViewOutline?docRootContentId=${docRootContentId}&targetNodeTrailCsv=${currentNodeTrailCsv}"); - expandCollapseLink.setTarget(target); + //expandCollapseLink.setTarget("/ViewOutline?docRootContentId=${docRootContentId}&targetNodeTrailCsv=${currentNodeTrailCsv}"); + expandCollapseLink.setTarget(target); } } else { context.put("processChildren", Boolean.TRUE); //expandCollapseLink.setText(" - "); String lastContentId = (String)currentNodeTrail.remove(currentNodeTrail.size() - 1); currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); - if (currentNodeTrailPiped == null) + if (currentNodeTrailPiped == null) { currentNodeTrailPiped = ""; + } context.put("currentNodeTrailPiped", currentNodeTrailPiped); //context.put("currentNodeTrailCsv", currentNodeTrailCsv); - expandCollapseImage.setSrc("/images/collapse.gif"); + expandCollapseLink.setStyle("expanded"); + expandCollapseLink.setText(" "); String target = node.getModelTree().getExpandCollapseRequest(context); String trailName = node.getModelTree().getTrailName(context); if (target.indexOf("?") < 0) target += "?"; @@ -145,25 +149,47 @@ // add it so it can be remove in renderNodeEnd currentNodeTrail.add(lastContentId); currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); - if (currentNodeTrailPiped == null) + if (currentNodeTrailPiped == null) { currentNodeTrailPiped = ""; + } context.put("currentNodeTrailPiped", currentNodeTrailPiped); } renderLink( writer, context, expandCollapseLink); } else if (!hasChildren){ - writer.write(" "); + //writer.write(" "); context.put("processChildren", Boolean.FALSE); //currentNodeTrail.add(contentId); } } public void renderNodeEnd(Writer writer, Map context, ModelTree.ModelNode node) throws IOException { - String style = node.getWrapStyle(context); - if (UtilValidate.isNotEmpty(style)) { - writer.write("</div>"); + if (node.isRootNode()) { + appendWhitespace(writer); + writer.write("</ul>"); + appendWhitespace(writer); + writer.write("<!-- end tree widget -->"); + appendWhitespace(writer); + } + else { + Boolean processChildren = (Boolean) context.get("processChildren"); + if (processChildren.booleanValue()) { + appendWhitespace(writer); + writer.write("</ul>"); + } + writer.write("</li>"); } } + public void renderLastElement(Writer writer, Map context, ModelTree.ModelNode node) throws IOException { + if (!node.isRootNode()) { + Boolean processChildren = (Boolean) context.get("processChildren"); + if (processChildren.booleanValue()) { + appendWhitespace(writer); + writer.write("<ul class=\"basic-tree\">"); + } + } + } + public void renderLabel(Writer writer, Map context, ModelTree.ModelNode.Label label) throws IOException { // open tag writer.write("<span"); @@ -268,7 +294,7 @@ // close tag writer.write("</a>"); - appendWhitespace(writer); +// appendWhitespace(writer); } public void renderImage(Writer writer, Map context, ModelTree.ModelNode.Image image) throws IOException { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Sat Mar 3 00:14:07 2007 @@ -50,7 +50,8 @@ protected String name; protected String type; protected String target; - protected String title; + protected String id; + protected FlexibleStringExpander title; protected String tooltip; protected String defaultEntityName; protected String defaultTitleStyle; @@ -139,6 +140,7 @@ if (parent != null) { this.type = parent.type; this.target = parent.target; + this.id = parent.id; this.title = parent.title; this.tooltip = parent.tooltip; this.tooltip = parent.tooltip; @@ -171,8 +173,10 @@ this.type = menuElement.getAttribute("type"); if (this.target == null || menuElement.hasAttribute("target")) this.target = menuElement.getAttribute("target"); + if (this.id == null || menuElement.hasAttribute("id")) + this.id = menuElement.getAttribute("id"); if (this.title == null || menuElement.hasAttribute("title")) - this.title = menuElement.getAttribute("title"); + this.setTitle(menuElement.getAttribute("title")); if (this.tooltip == null || menuElement.hasAttribute("tooltip")) this.tooltip = menuElement.getAttribute("tooltip"); if (this.defaultEntityName == null || menuElement.hasAttribute("default-entity-name")) @@ -448,12 +452,18 @@ return this.name; } + /** + * @return + */ + public String getId() { + return this.id; + } /** * @return */ - public String getTitle() { - return this.title; + public String getTitle(Map context) { + return title.expandString(context); } /** @@ -547,8 +557,15 @@ /** * @param string */ + public void setId(String string) { + this.id = string; + } + + /** + * @param string + */ public void setTitle(String string) { - this.title = string; + this.title = new FlexibleStringExpander(string); } /** @@ -725,6 +742,7 @@ + "\n name=" + this.name + "\n type=" + this.type + "\n target=" + this.target + + "\n id=" + this.id + "\n title=" + this.title + "\n tooltip=" + this.tooltip + "\n defaultEntityName=" + this.defaultEntityName Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Sat Mar 3 00:14:07 2007 @@ -435,6 +435,7 @@ if (link != null) { link.renderLinkString(writer, context, treeStringRenderer); } + treeStringRenderer.renderLastElement(writer, context, this); Boolean processChildren = (Boolean) context .get("processChildren"); //if (Debug.infoOn()) Debug.logInfo(" processChildren:" + processChildren, module); if (processChildren.booleanValue()) { @@ -642,6 +643,10 @@ return isFollowTrail; } + public boolean isRootNode() { + return name.equals(modelTree.getRootNodeName()); + } + public boolean showPeers(int currentDepth) { int trailSize = 0; List trail = modelTree.getTrailList(); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeStringRenderer.java?view=diff&rev=514099&r1=514098&r2=514099 ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeStringRenderer.java Sat Mar 3 00:14:07 2007 @@ -34,5 +34,6 @@ public void renderLabel(Writer writer, Map context, ModelTree.ModelNode.Label label) throws IOException; public void renderLink(Writer writer, Map context, ModelTree.ModelNode.Link link) throws IOException; public void renderImage(Writer writer, Map context, ModelTree.ModelNode.Image image) throws IOException; + public void renderLastElement(Writer writer, Map context, ModelTree.ModelNode node) throws IOException; public ScreenStringRenderer getScreenStringRenderer( Map context); } |
Free forum by Nabble | Edit this page |