Author: mbrohl
Date: Sat Dec 16 18:00:42 2017 New Revision: 1818443 URL: http://svn.apache.org/viewvc?rev=1818443&view=rev Log: Improved: General refactoring and code improvements, package org.apache.ofbiz.widget.renderer.macro. (OFBIZ-9960) Thanks Dennis Balkir for reporting and providing the patches. Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java?rev=1818443&r1=1818442&r2=1818443&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java Sat Dec 16 18:00:42 2017 @@ -108,7 +108,7 @@ public final class MacroFormRenderer imp public static final String module = MacroFormRenderer.class.getName(); private final Template macroLibrary; - private final WeakHashMap<Appendable, Environment> environments = new WeakHashMap<Appendable, Environment>(); + private final WeakHashMap<Appendable, Environment> environments = new WeakHashMap<>(); private final UtilCodec.SimpleEncoder internalEncoder; private final RequestHandler rh; private final HttpServletRequest request; @@ -142,7 +142,7 @@ public final class MacroFormRenderer imp this.renderPagination = renderPagination; } - private void executeMacro(Appendable writer, String macro) throws IOException { + private void executeMacro(Appendable writer, String macro) { try { Environment environment = getEnvironment(writer); environment.setVariable("visualTheme", FreeMarkerWorker.autoWrap(visualTheme, environment)); @@ -183,7 +183,7 @@ public final class MacroFormRenderer imp return htmlString.replaceAll("\"", "\\\\\""); } - public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { + public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) { String labelText = label.getText(context); if (UtilValidate.isEmpty(labelText)) { // nothing to render @@ -329,7 +329,7 @@ public final class MacroFormRenderer imp this.request.setAttribute("width", hyperlinkField.getWidth()); this.request.setAttribute("height", hyperlinkField.getHeight()); makeHyperlinkByType(writer, hyperlinkField.getLinkType(), modelFormField.getWidgetStyle(), hyperlinkField.getUrlMode(), hyperlinkField.getTarget(context), - hyperlinkField.getParameterMap(context, modelFormField.getEntityName(), modelFormField.getServiceName()), + hyperlinkField.getParameterMap(context, modelFormField.getEntityName(), modelFormField.getServiceName()), hyperlinkField.getDescription(context), hyperlinkField.getTargetWindow(context), hyperlinkField.getConfirmation(context), modelFormField, this.request, this.response, context); this.appendTooltip(writer, context, modelFormField); @@ -367,12 +367,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } List<ModelForm.UpdateArea> updateAreas = modelFormField.getOnChangeUpdateAreas(); boolean ajaxEnabled = updateAreas != null && this.javaScriptEnabled; @@ -455,12 +457,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } String visualEditorEnable = ""; String buttons = ""; @@ -591,10 +595,11 @@ public final class MacroFormRenderer imp */ ModelFormFieldBuilder builder = new ModelFormFieldBuilder(modelFormField); boolean memEncodeOutput = modelFormField.getEncodeOutput(); - if (useTimeDropDown) + if (useTimeDropDown) { // If time-dropdown deactivate encodingOutput for found hour and minutes // FIXME: Encoding should be controlled by the renderer, not by the model. builder.setEncodeOutput(false); + } // FIXME: modelFormField.getEntry ignores shortDateInput when converting Date objects to Strings. if (useTimeDropDown) { builder.setEncodeOutput(memEncodeOutput); @@ -673,12 +678,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } String mask = dateTimeField.getMask(); if ("Y".equals(mask)) { @@ -806,12 +813,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } String currentDescription = null; if (UtilValidate.isNotEmpty(currentValue)) { @@ -1147,7 +1156,7 @@ public final class MacroFormRenderer imp String backgroundSubmitRefreshTarget = submitField.getBackgroundSubmitRefreshTarget(context); if (UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) { if (updateAreas == null) { - updateAreas = new LinkedList<ModelForm.UpdateArea>(); + updateAreas = new LinkedList<>(); } updateAreas.add(new ModelForm.UpdateArea("submit", formId, backgroundSubmitRefreshTarget)); } @@ -1361,7 +1370,6 @@ public final class MacroFormRenderer imp String targ = modelForm.getTarget(context, targetType); StringBuilder linkUrl = new StringBuilder(); if (UtilValidate.isNotEmpty(targ)) { - //this.appendOfbizUrl(writer, "/" + targ); WidgetWorker.buildHyperlinkUrl(linkUrl, targ, targetType, null, null, false, false, true, request, response, context); } String formType = modelForm.getType(); @@ -1493,8 +1501,8 @@ public final class MacroFormRenderer imp this.renderNextPrev(writer, context, modelForm); } List<ModelFormField> childFieldList = modelForm.getFieldList(); - List<String> columnStyleList = new LinkedList<String>(); - List<String> fieldNameList = new LinkedList<String>(); + List<String> columnStyleList = new LinkedList<>(); + List<String> fieldNameList = new LinkedList<>(); for (ModelFormField childField : childFieldList) { int childFieldType = childField.getFieldInfo().getFieldType(); if (childFieldType == FieldInfo.HIDDEN || childFieldType == FieldInfo.IGNORED) { @@ -1874,7 +1882,6 @@ public final class MacroFormRenderer imp String opGreaterThanEquals = UtilProperties.getMessage("conditionalUiLabels", "greater_than_equals", locale); String opLessThan = UtilProperties.getMessage("conditionalUiLabels", "less_than", locale); String opLessThanEquals = UtilProperties.getMessage("conditionalUiLabels", "less_than_equals", locale); - //String opIsEmpty = UtilProperties.getMessage("conditionalUiLabels", "is_empty", locale); String className = ""; String alert = "false"; if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { @@ -2106,12 +2113,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } String name = modelFormField.getParameterName(context); String value = modelFormField.getEntry(context, lookupField.getDefaultValue(context)); @@ -2131,7 +2140,7 @@ public final class MacroFormRenderer imp autoCompleterTarget = lookupFieldFormName + "&amp;"; } autoCompleterTarget = autoCompleterTarget + "ajaxLookup=Y"; - updateAreas = new LinkedList<ModelForm.UpdateArea>(); + updateAreas = new LinkedList<>(); updateAreas.add(new ModelForm.UpdateArea("change", id, autoCompleterTarget)); } boolean ajaxEnabled = UtilValidate.isNotEmpty(updateAreas) && this.javaScriptEnabled; @@ -2280,7 +2289,7 @@ public final class MacroFormRenderer imp this.appendTooltip(writer, context, modelFormField); } - public void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + public void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm) { boolean ajaxEnabled = false; List<ModelForm.UpdateArea> updateAreas = modelForm.getOnPaginateUpdateAreas(); String targetService = modelForm.getPaginateTarget(context); @@ -2318,22 +2327,25 @@ public final class MacroFormRenderer imp commonDisplaying = UtilProperties.getMessage("CommonUiLabels", "CommonDisplaying", messageMap, (Locale) context.get("locale")); } // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex" - if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) + if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) { viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; - if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) + } + if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) { viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; + } String str = (String) context.get("_QBESTRING_"); // strip legacy viewIndex/viewSize params from the query string String queryString = UtilHttp.stripViewParamsFromQueryString(str, "" + paginatorNumber); // strip parameterized index/size params from the query string - Set<String> paramNames = new HashSet<String>(); + Set<String> paramNames = new HashSet<>(); paramNames.add(viewIndexParam); paramNames.add(viewSizeParam); queryString = UtilHttp.stripNamedParamsFromQueryString(queryString, paramNames); String anchor = ""; String paginateAnchor = modelForm.getPaginateTargetAnchor(); - if (UtilValidate.isNotEmpty(paginateAnchor)) + if (UtilValidate.isNotEmpty(paginateAnchor)) { anchor = "#" + paginateAnchor; + } // Create separate url path String and request parameters String, // add viewIndex/viewSize parameters to request parameter String String urlPath = UtilHttp.removeQueryStringFromTarget(targetService); @@ -2590,12 +2602,14 @@ public final class MacroFormRenderer imp //check for required field style on single forms if ("single".equals(modelFormField.getModelForm().getType()) && modelFormField.getRequiredField()) { String requiredStyle = modelFormField.getRequiredFieldStyle(); - if (UtilValidate.isEmpty(requiredStyle)) + if (UtilValidate.isEmpty(requiredStyle)) { requiredStyle = "required"; - if (UtilValidate.isEmpty(className)) + } + if (UtilValidate.isEmpty(className)) { className = requiredStyle; - else + } else { className = requiredStyle + " " + className; + } } String tabindex = modelFormField.getTabindex(); @@ -2683,7 +2697,6 @@ public final class MacroFormRenderer imp if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) || UtilValidate.isNotEmpty(title)) { if (fieldGroup.collapsible()) { Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); - //Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); if (uiLabelMap != null) { expandToolTip = (String) uiLabelMap.get("CommonExpand"); collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); @@ -2740,11 +2753,13 @@ public final class MacroFormRenderer imp public void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException { String style = banner.getStyle(context); String leftStyle = banner.getLeftTextStyle(context); - if (UtilValidate.isEmpty(leftStyle)) + if (UtilValidate.isEmpty(leftStyle)) { leftStyle = style; + } String rightStyle = banner.getRightTextStyle(context); - if (UtilValidate.isEmpty(rightStyle)) + if (UtilValidate.isEmpty(rightStyle)) { rightStyle = style; + } String leftText = banner.getLeftText(context); if (leftText == null) { leftText = ""; @@ -2781,7 +2796,7 @@ public final class MacroFormRenderer imp * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param modelWidget The widget */ - public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) { if (this.widgetCommentsEnabled) { StringWriter sr = new StringWriter(); sr.append("<@formatBoundaryComment "); @@ -2802,7 +2817,7 @@ public final class MacroFormRenderer imp * @param widgetType The widget type: "Screen Widget", "Form Widget", etc. * @param modelWidget The widget */ - public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) { if (this.widgetCommentsEnabled) { StringWriter sr = new StringWriter(); sr.append("<@formatBoundaryComment "); @@ -2817,7 +2832,7 @@ public final class MacroFormRenderer imp } } - public void renderSortField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException { + public void renderSortField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) { boolean ajaxEnabled = false; ModelForm modelForm = modelFormField.getModelForm(); List<ModelForm.UpdateArea> updateAreas = modelForm.getOnSortColumnUpdateAreas(); @@ -3011,7 +3026,7 @@ public final class MacroFormRenderer imp return targetParams; } - public void appendTooltip(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + public void appendTooltip(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) { // render the tooltip, in other methods too String tooltip = modelFormField.getTooltip(context); StringWriter sr = new StringWriter(); @@ -3029,8 +3044,12 @@ public final class MacroFormRenderer imp return; } if (subHyperlink.shouldUse(context)) { - if (UtilValidate.isNotEmpty(subHyperlink.getWidth())) this.request.setAttribute("width", subHyperlink.getWidth()); - if (UtilValidate.isNotEmpty(subHyperlink.getHeight())) this.request.setAttribute("height", subHyperlink.getHeight()); + if (UtilValidate.isNotEmpty(subHyperlink.getWidth())) { + this.request.setAttribute("width", subHyperlink.getWidth()); + } + if (UtilValidate.isNotEmpty(subHyperlink.getHeight())) { + this.request.setAttribute("height", subHyperlink.getHeight()); + } writer.append(' '); makeHyperlinkByType(writer, subHyperlink.getLinkType(), subHyperlink.getStyle(context), subHyperlink.getUrlMode(), subHyperlink.getTarget(context), subHyperlink.getParameterMap(context, subHyperlink.getModelFormField().getEntityName(), subHyperlink.getModelFormField().getServiceName()), subHyperlink.getDescription(context), @@ -3039,7 +3058,7 @@ public final class MacroFormRenderer imp } } - public void addAsterisks(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + public void addAsterisks(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) { String requiredField = "false"; String requiredStyle = ""; if (modelFormField.getRequiredField()) { @@ -3223,7 +3242,7 @@ public final class MacroFormRenderer imp } } - public void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { + public void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) { if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { String hiddenFormName = WidgetWorker.makeLinkHiddenFormName(context, modelFormField); String event = ""; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java?rev=1818443&r1=1818442&r2=1818443&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroMenuRenderer.java Sat Dec 16 18:00:42 2017 @@ -57,7 +57,7 @@ public class MacroMenuRenderer implement public static final String module = MacroMenuRenderer.class.getName(); private int macroCount = 999; - private final Map<Appendable, Environment> environments = new HashMap<Appendable, Environment>(); + private final Map<Appendable, Environment> environments = new HashMap<>(); private final Template macroLibrary; private final HttpServletRequest request; private final HttpServletResponse response; @@ -72,7 +72,7 @@ public class MacroMenuRenderer implement // Made this a separate method so it can be externalized and reused. private Map<String, Object> createImageParameters(Map<String, Object> context, Image image) { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("id", image.getId(context)); parameters.put("style", image.getStyle(context)); parameters.put("width", image.getWidth(context)); @@ -199,7 +199,7 @@ public class MacroMenuRenderer implement @Override public void renderLink(Appendable writer, Map<String, Object> context, MenuLink link) throws IOException { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); String target = link.getTarget(context); ModelMenuItem menuItem = link.getLinkMenuItem(); if (isDisableIfEmpty(menuItem, context)) { @@ -221,7 +221,7 @@ public class MacroMenuRenderer implement if (context.containsKey("parentItemIndex")) { uniqueItemName.append(context.get("parentItemIndex")).append("_").append(context.get("itemIndex")); } else { - uniqueItemName.append("_").append(context.get("itemIndex")); + uniqueItemName.append("_").append(context.get("itemIndex")); } } parameters.put("uniqueItemName", uniqueItemName.toString()); @@ -284,7 +284,7 @@ public class MacroMenuRenderer implement public void renderMenuClose(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException { Map<String, Object> parameters = null; if (ModelWidget.widgetBoundaryCommentsEnabled(context)) { - parameters = new HashMap<String, Object>(); + parameters = new HashMap<>(); StringBuilder sb = new StringBuilder("End Menu Widget "); sb.append(menu.getBoundaryCommentName()); parameters.put("boundaryComment", sb.toString()); @@ -298,9 +298,10 @@ public class MacroMenuRenderer implement @Override public void renderMenuItem(Appendable writer, Map<String, Object> context, ModelMenuItem menuItem) throws IOException { - if (isHideIfSelected(menuItem, context)) + if (isHideIfSelected(menuItem, context)) { return; - Map<String, Object> parameters = new HashMap<String, Object>(); + } + Map<String, Object> parameters = new HashMap<>(); String style = menuItem.getWidgetStyle(); if (menuItem.isSelected(context)) { String selectedStyle = menuItem.getSelectedStyle(); @@ -361,7 +362,7 @@ public class MacroMenuRenderer implement @Override public void renderMenuOpen(Appendable writer, Map<String, Object> context, ModelMenu menu) throws IOException { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); if (ModelWidget.widgetBoundaryCommentsEnabled(context)) { StringBuilder sb = new StringBuilder("Begin Menu Widget "); sb.append(menu.getBoundaryCommentName()); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java?rev=1818443&r1=1818442&r2=1818443&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenRenderer.java Sat Dec 16 18:00:42 2017 @@ -45,7 +45,6 @@ import org.apache.ofbiz.base.util.UtilVa import org.apache.ofbiz.base.util.template.FreeMarkerWorker; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericValue; -import org.apache.ofbiz.entity.util.EntityUtilProperties; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.webapp.control.RequestHandler; import org.apache.ofbiz.webapp.taglib.ContentUrlTag; @@ -75,7 +74,7 @@ public class MacroScreenRenderer impleme public static final String module = MacroScreenRenderer.class.getName(); private Template macroLibrary; - private WeakHashMap<Appendable, Environment> environments = new WeakHashMap<Appendable, Environment>(); + private WeakHashMap<Appendable, Environment> environments = new WeakHashMap<>(); private String rendererName; private int elementId = 999; protected boolean widgetCommentsEnabled = false; @@ -104,9 +103,7 @@ public class MacroScreenRenderer impleme Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig()); templateReader.close(); environment.include(template); - } catch (TemplateException e) { - Debug.logError(e, "Error rendering screen macro [" + macro + "] thru ftl", module); - } catch (IOException e) { + } catch (TemplateException |IOException e) { Debug.logError(e, "Error rendering screen macro [" + macro + "] thru ftl", module); } } @@ -160,7 +157,7 @@ public class MacroScreenRenderer impleme this.widgetCommentsEnabled = ModelWidget.widgetBoundaryCommentsEnabled(context); } if (this.widgetCommentsEnabled) { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); StringBuilder sb = new StringBuilder("Begin "); sb.append(section.isMainSection() ? "Screen " : "Section Widget "); sb.append(section.getBoundaryCommentName()); @@ -170,7 +167,7 @@ public class MacroScreenRenderer impleme } public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { if (this.widgetCommentsEnabled) { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); StringBuilder sb = new StringBuilder(); sb.append("End "); sb.append(section.isMainSection() ? "Screen " : "Section Widget "); @@ -194,7 +191,7 @@ public class MacroScreenRenderer impleme RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); autoUpdateLink = rh.makeLink(request, response, autoUpdateTarget); } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("id", containerId); parameters.put("style", container.getStyle(context)); parameters.put("autoUpdateLink", autoUpdateLink); @@ -207,7 +204,7 @@ public class MacroScreenRenderer impleme } public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("text", label.getText(context)); parameters.put("id", label.getId(context)); parameters.put("style", label.getStyle(context)); @@ -215,7 +212,7 @@ public class MacroScreenRenderer impleme } public void renderHorizontalSeparator(Appendable writer, Map<String, Object> context, ModelScreenWidget.HorizontalSeparator separator) throws IOException { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("id", separator.getId(context)); parameters.put("style", separator.getStyle(context)); executeMacro(writer, "renderHorizontalSeparator", parameters); @@ -316,8 +313,9 @@ public class MacroScreenRenderer impleme } public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.ScreenImage image) throws IOException { - if (image == null) + if (image == null) { return ; + } String src = image.getSrc(context); String urlMode = image.getUrlMode(); @@ -345,7 +343,7 @@ public class MacroScreenRenderer impleme } else { urlString = src; } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("src", src); parameters.put("id", image.getId(context)); parameters.put("style", image.getStyle(context)); @@ -362,9 +360,11 @@ public class MacroScreenRenderer impleme String enableEditName = content.getEnableEditName(context); String enableEditValue = (String)context.get(enableEditName); - if (Debug.verboseOn()) Debug.logVerbose("directEditRequest:" + editRequest, module); + if (Debug.verboseOn()) { + Debug.logVerbose("directEditRequest:" + editRequest, module); + } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("editRequest", editRequest); parameters.put("enableEditValue", enableEditValue == null ? "" : enableEditValue); parameters.put("editContainerStyle", content.getEditContainerStyle(context)); @@ -373,7 +373,6 @@ public class MacroScreenRenderer impleme public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { Locale locale = UtilMisc.ensureLocale(context.get("locale")); - //Boolean nullThruDatesOnly = Boolean.valueOf(false); String mimeTypeId = "text/html"; String expandedContentId = content.getContentId(context); String expandedDataResourceId = content.getDataResourceId(context); @@ -382,10 +381,12 @@ public class MacroScreenRenderer impleme Delegator delegator = (Delegator) context.get("delegator"); // make a new map for content rendering; so our current map does not get clobbered - Map<String, Object> contentContext = new HashMap<String, Object>(); + Map<String, Object> contentContext = new HashMap<>(); contentContext.putAll(context); String dataResourceId = (String)contentContext.get("dataResourceId"); - if (Debug.verboseOn()) Debug.logVerbose("expandedContentId:" + expandedContentId, module); + if (Debug.verboseOn()) { + Debug.logVerbose("expandedContentId:" + expandedContentId, module); + } try { if (UtilValidate.isNotEmpty(dataResourceId)) { @@ -424,14 +425,9 @@ public class MacroScreenRenderer impleme writer.append(renderedContent); } - } catch (GeneralException e) { + } catch (GeneralException |IOException e) { String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e.toString(); Debug.logError(e, errMsg, module); - //throw new RuntimeException(errMsg); - } catch (IOException e2) { - String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e2.toString(); - Debug.logError(e2, errMsg, module); - //throw new RuntimeException(errMsg); } } @@ -450,16 +446,18 @@ public class MacroScreenRenderer impleme HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); if (request != null && response != null) { - if (editRequest.indexOf('?') < 0) + if (editRequest.indexOf('?') < 0) { editRequest += "?"; - else editRequest += "&"; + } else { + editRequest += "&"; + } editRequest += "contentId=" + expandedContentId; ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); urlString = rh.makeLink(request, response, editRequest, false, false, false); } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("urlString", urlString); parameters.put("editMode", editMode); parameters.put("editContainerStyle", content.getEditContainerStyle(context)); @@ -481,7 +479,7 @@ public class MacroScreenRenderer impleme fullUrlString = rh.makeLink(request, response, urlString, true, false, false); } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("fullUrl", fullUrlString); parameters.put("width", content.getWidth()); parameters.put("height", content.getHeight()); @@ -493,7 +491,7 @@ public class MacroScreenRenderer impleme String enableEditName = content.getEnableEditName(context); String enableEditValue = (String)context.get(enableEditName); - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("editContainerStyle", content.getEditContainerStyle(context)); parameters.put("editRequest", content.getEditRequest(context)); parameters.put("enableEditValue", enableEditValue == null ? "" : enableEditValue); @@ -509,13 +507,12 @@ public class MacroScreenRenderer impleme LocalDispatcher dispatcher = (LocalDispatcher) context.get("dispatcher"); // create a new map for the content rendering; so our current context does not get overwritten! - Map<String, Object> contentContext = new HashMap<String, Object>(); + Map<String, Object> contentContext = new HashMap<>(); contentContext.putAll(context); try { if (WidgetContentWorker.getContentWorker() != null) { renderedContent = WidgetContentWorker.getContentWorker().renderSubContentAsTextExt(dispatcher, expandedContentId, expandedMapKey, contentContext, locale, mimeTypeId, true); - //Debug.logInfo("renderedContent=" + renderedContent, module); } else { Debug.logError("Not rendering content, WidgetContentWorker.contentWorker not found.", module); } @@ -536,14 +533,9 @@ public class MacroScreenRenderer impleme writer.append(renderedContent); } - } catch (GeneralException e) { + } catch (GeneralException | IOException e) { String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e.toString(); Debug.logError(e, errMsg, module); - //throw new RuntimeException(errMsg); - } catch (IOException e2) { - String errMsg = "Error rendering included content with id [" + expandedContentId + "] : " + e2.toString(); - Debug.logError(e2, errMsg, module); - //throw new RuntimeException(errMsg); } } @@ -562,9 +554,11 @@ public class MacroScreenRenderer impleme HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); if (request != null && response != null) { - if (editRequest.indexOf('?') < 0) + if (editRequest.indexOf('?') < 0) { editRequest += "?"; - else editRequest += "&"; + } else { + editRequest += "&"; + } editRequest += "contentId=" + expandedContentId; if (UtilValidate.isNotEmpty(expandedMapKey)) { editRequest += "&mapKey=" + expandedMapKey; @@ -575,7 +569,7 @@ public class MacroScreenRenderer impleme } } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("urlString", urlString); parameters.put("editMode", editMode); parameters.put("editContainerStyle", content.getEditContainerStyle(context)); @@ -611,7 +605,7 @@ public class MacroScreenRenderer impleme this.getNextElementId(); Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); - Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap); + Map<String, Object> requestParameters = new HashMap<>(paramMap); if (uiLabelMap != null) { expandToolTip = (String) uiLabelMap.get("CommonExpand"); collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); @@ -632,7 +626,7 @@ public class MacroScreenRenderer impleme navMenu.renderWidgetString(sb, context, this); context.put("menuStringRenderer", savedRenderer); } catch (TemplateException e) { - Debug.logError(e, module); + Debug.logError(e, module); } } else if (navForm != null) { renderScreenletPaginateMenu(sb, context, navForm); @@ -640,7 +634,7 @@ public class MacroScreenRenderer impleme menuString = sb.toString(); } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("title", title); parameters.put("collapsible", collapsible); parameters.put("saveCollapsed", screenlet.saveCollapsed()); @@ -721,7 +715,9 @@ public class MacroScreenRenderer impleme int actualPageSize = Paginator.getActualPageSize(context); // if this is all there seems to be (if listSize < 0, then size is unknown) - if (actualPageSize >= listSize && listSize >= 0) return; + if (actualPageSize >= listSize && listSize >= 0) { + return; + } // needed for the "Page" and "rows" labels Map<String, String> uiLabelMap = UtilGenerics.cast(context.get("uiLabelMap")); @@ -734,8 +730,12 @@ public class MacroScreenRenderer impleme } // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex" - if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; - if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; + if (("viewIndex" + "_" + paginatorNumber).equals(viewIndexParam)) { + viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; + } + if (("viewSize" + "_" + paginatorNumber).equals(viewSizeParam)) { + viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; + } ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); @@ -749,14 +749,16 @@ public class MacroScreenRenderer impleme // strip legacy viewIndex/viewSize params from the query string queryString = UtilHttp.stripViewParamsFromQueryString(queryString, "" + paginatorNumber); // strip parametrized index/size params from the query string - HashSet<String> paramNames = new HashSet<String>(); + HashSet<String> paramNames = new HashSet<>(); paramNames.add(viewIndexParam); paramNames.add(viewSizeParam); queryString = UtilHttp.stripNamedParamsFromQueryString(queryString, paramNames); String anchor = ""; String paginateAnchor = modelForm.getPaginateTargetAnchor(); - if (paginateAnchor != null) anchor = "#" + paginateAnchor; + if (paginateAnchor != null) { + anchor = "#" + paginateAnchor; + } // preparing the link text, so that later in the code we can reuse this and just add the viewIndex String prepLinkText = ""; @@ -800,7 +802,7 @@ public class MacroScreenRenderer impleme firstLinkUrl = rh.makeLink(request, response, linkText); } - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); parameters.put("lowIndex", Paginator.getLowIndex(context)); parameters.put("actualPageSize", actualPageSize); parameters.put("ofLabel", ofLabel); @@ -1012,15 +1014,7 @@ public class MacroScreenRenderer impleme if (UtilValidate.isNotEmpty(screenName) && UtilValidate.isNotEmpty(screenLocation)) { try { modelScreen = ScreenFactory.getScreenFromLocation(screenLocation, screenName); - } catch (IOException e) { - String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); - } catch (SAXException e) { - String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); - } catch (ParserConfigurationException e) { + } catch (IOException | SAXException | ParserConfigurationException e) { String errMsg = "Error rendering portlet ID [" + portalPortletId + "]: " + e.toString(); Debug.logError(e, errMsg, module); throw new RuntimeException(errMsg); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java?rev=1818443&r1=1818442&r2=1818443&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroScreenViewHandler.java Sat Dec 16 18:00:42 2017 @@ -20,7 +20,6 @@ package org.apache.ofbiz.widget.renderer import java.io.IOException; import java.io.Writer; -import java.util.List; import java.util.Map; import javax.servlet.ServletContext; @@ -31,16 +30,10 @@ import javax.xml.parsers.ParserConfigura import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; import org.apache.ofbiz.base.util.UtilCodec; -import org.apache.ofbiz.base.util.UtilGenerics; import org.apache.ofbiz.base.util.UtilHttp; -import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.base.util.collections.MapStack; import org.apache.ofbiz.entity.Delegator; -import org.apache.ofbiz.entity.util.EntityUtilProperties; -import org.apache.ofbiz.service.LocalDispatcher; -import org.apache.ofbiz.service.ModelService; -import org.apache.ofbiz.service.ServiceUtil; import org.apache.ofbiz.webapp.view.AbstractViewHandler; import org.apache.ofbiz.webapp.view.ViewHandlerException; import org.apache.ofbiz.widget.model.ModelTheme; @@ -66,8 +59,8 @@ public class MacroScreenViewHandler exte } private ScreenStringRenderer loadRenderers(HttpServletRequest request, HttpServletResponse response, - Map<String, Object> context, Writer writer) throws GeneralException, TemplateException, IOException { - VisualTheme visualTheme = (VisualTheme) UtilHttp.getVisualTheme(request); + Map<String, Object> context, Writer writer) throws TemplateException, IOException { + VisualTheme visualTheme = UtilHttp.getVisualTheme(request); ModelTheme modelTheme = visualTheme.getModelTheme(); String screenMacroLibraryPath = modelTheme.getScreenRendererLocation(getName()); @@ -127,9 +120,7 @@ public class MacroScreenViewHandler exte throw new ViewHandlerException(e.getMessage()); } catch (IOException e) { throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e); - } catch (SAXException e) { - throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e); - } catch (ParserConfigurationException e) { + } catch (SAXException | ParserConfigurationException e) { throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e); } catch (GeneralException e) { throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java?rev=1818443&r1=1818442&r2=1818443&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroTreeRenderer.java Sat Dec 16 18:00:42 2017 @@ -50,7 +50,7 @@ import freemarker.template.TemplateExcep /** * Widget Library - Tree Renderer implementation based on Freemarker macros - * + * */ public class MacroTreeRenderer implements TreeStringRenderer { @@ -65,7 +65,7 @@ public class MacroTreeRenderer implement this.environment = FreeMarkerWorker.renderTemplate(this.macroLibrary, input, writer); } - private void executeMacro(String macro) throws IOException { + private void executeMacro(String macro) { try { Reader templateReader = new StringReader(macro); // FIXME: I am using a Date as an hack to provide a unique name for the template... @@ -73,20 +73,18 @@ public class MacroTreeRenderer implement FreeMarkerWorker.getDefaultOfbizConfig()); templateReader.close(); this.environment.include(template); - } catch (TemplateException e) { - Debug.logError(e, "Error rendering tree thru ftl", module); - } catch (IOException e) { + } catch (TemplateException | IOException e) { Debug.logError(e, "Error rendering tree thru ftl", module); } } - + /** * Renders the beginning boundary comment string. * @param writer The writer to write to * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc. * @param modelWidget The widget */ - public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderBeginningBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) { StringWriter sr = new StringWriter(); sr.append("<@formatBoundaryComment "); sr.append(" boundaryType=\""); @@ -98,14 +96,14 @@ public class MacroTreeRenderer implement sr.append("\" />"); executeMacro(sr.toString()); } - + /** * Renders the ending boundary comment string. * @param writer The writer to write to * @param widgetType The widget type: "Screen Widget", "Tree Widget", etc. * @param modelWidget The widget */ - public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) throws IOException { + public void renderEndingBoundaryComment(Appendable writer, String widgetType, ModelWidget modelWidget) { StringWriter sr = new StringWriter(); sr.append("<@formatBoundaryComment "); sr.append(" boundaryType=\""); @@ -117,11 +115,11 @@ public class MacroTreeRenderer implement sr.append("\" />"); executeMacro(sr.toString()); } - + public void renderNodeBegin(Appendable writer, Map<String, Object> context, ModelTree.ModelNode node, int depth) throws IOException { String currentNodeTrailPiped = null; List<String> currentNodeTrail = UtilGenerics.toList(context.get("currentNodeTrail")); - + String style = ""; if (node.isRootNode()) { if (ModelWidget.widgetBoundaryCommentsEnabled(context)) { @@ -129,7 +127,7 @@ public class MacroTreeRenderer implement } style = "basic-tree"; } - + StringWriter sr = new StringWriter(); sr.append("<@renderNodeBegin "); sr.append(" style=\""); @@ -163,7 +161,6 @@ public class MacroTreeRenderer implement // Not on the trail if (node.showPeers(depth, context)) { context.put("processChildren", Boolean.FALSE); - //expandCollapseLink.setText(" + "); currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); StringBuilder target = new StringBuilder(node.getModelTree().getExpandCollapseRequest(context)); String trailName = node.getModelTree().getTrailName(context); @@ -177,7 +174,6 @@ public class MacroTreeRenderer implement } } else { context.put("processChildren", Boolean.TRUE); - //expandCollapseLink.setText(" - "); String lastContentId = currentNodeTrail.remove(currentNodeTrail.size() - 1); currentNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); if (currentNodeTrailPiped == null) { @@ -235,7 +231,7 @@ public class MacroTreeRenderer implement } public void renderLabel(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Label label) throws IOException { - String id = label.getId(context); + String id = label.getId(context); String style = label.getStyle(context); String labelText = label.getText(context); @@ -256,19 +252,19 @@ public class MacroTreeRenderer implement StringBuilder linkUrl = new StringBuilder(); HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); - + if (UtilValidate.isNotEmpty(target)) { WidgetWorker.buildHyperlinkUrl(linkUrl, target, link.getUrlMode(), link.getParameterMap(context), link.getPrefix(context), link.getFullPath(), link.getSecure(), link.getEncode(), request, response, context); } - + String id = link.getId(context); String style = link.getStyle(context); String name = link.getName(context); String title = link.getTitle(context); String targetWindow = link.getTargetWindow(context); String linkText = link.getText(context); - + String imgStr = ""; ModelTree.ModelNode.Image img = link.getImage(); if (img != null) { @@ -276,7 +272,7 @@ public class MacroTreeRenderer implement renderImage(sw, context, img); imgStr = sw.toString(); } - + StringWriter sr = new StringWriter(); sr.append("<@renderLink "); sr.append("id=\""); @@ -296,16 +292,16 @@ public class MacroTreeRenderer implement sr.append("\" imgStr=\""); sr.append(imgStr.replaceAll("\"", "\\\\\"")); sr.append("\" />"); - executeMacro(sr.toString().replace("|", "%7C")); // Fix for OFBIZ-9191 + executeMacro(sr.toString().replace("|", "%7C")); // Fix for OFBIZ-9191 } - + public void renderImage(Appendable writer, Map<String, Object> context, ModelTree.ModelNode.Image image) throws IOException { if (image == null) { return; } HttpServletResponse response = (HttpServletResponse) context.get("response"); HttpServletRequest request = (HttpServletRequest) context.get("request"); - + String urlMode = image.getUrlMode(); String src = image.getSrc(context); String id = image.getId(context); @@ -314,12 +310,12 @@ public class MacroTreeRenderer implement String hgt = image.getHeight(context); String border = image.getBorder(context); String alt = ""; //TODO add alt to tree images image.getAlt(context); - + boolean fullPath = false; boolean secure = false; boolean encode = false; String urlString = ""; - + if (urlMode != null && "intra-app".equalsIgnoreCase(urlMode)) { if (request != null && response != null) { ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); @@ -364,7 +360,7 @@ public class MacroTreeRenderer implement ScreenRenderer screenRenderer = (ScreenRenderer)context.get("screens"); if (screenRenderer != null) { return screenRenderer.getScreenStringRenderer(); - } + } return null; } } |
Free forum by Nabble | Edit this page |