|
Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sat Aug 4 18:11:00 2012 @@ -38,6 +38,7 @@ import javax.servlet.http.HttpServletRes import javolution.util.FastList; +import org.apache.commons.lang.StringEscapeUtils; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; @@ -53,8 +54,6 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; -import org.ofbiz.widget.ModelWidget.ShowPortletItemData; -import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; import org.ofbiz.widget.form.ModelFormField.CheckField; import org.ofbiz.widget.form.ModelFormField.ContainerField; import org.ofbiz.widget.form.ModelFormField.DateFindField; @@ -72,8 +71,6 @@ import org.ofbiz.widget.form.ModelFormFi import org.ofbiz.widget.form.ModelFormField.RadioField; import org.ofbiz.widget.form.ModelFormField.RangeFindField; import org.ofbiz.widget.form.ModelFormField.ResetField; -import org.ofbiz.widget.form.ModelFormField.ShowPortletItem; -import org.ofbiz.widget.form.ModelFormField.ShowPortletLink; import org.ofbiz.widget.form.ModelFormField.SubmitField; import org.ofbiz.widget.form.ModelFormField.TextField; import org.ofbiz.widget.form.ModelFormField.TextFindField; @@ -334,7 +331,6 @@ public class MacroFormRenderer implement public void renderTextField(Appendable writer, Map<String, Object> context, TextField textField) throws IOException { ModelFormField modelFormField = textField.getModelFormField(); String name = modelFormField.getParameterName(context); - boolean validateLinkOnEnter = modelFormField.getModelForm().getValidateLinkOnEnter(); // #Eam# validate-form String className = ""; String alert = "false"; String mask = ""; @@ -406,18 +402,6 @@ public class MacroFormRenderer implement sr.append(" clientAutocomplete=\""); sr.append(clientAutocomplete); - // #Bam# validate-form - if (validateLinkOnEnter) { - sr.append("\" validateLinkOnEnter="); - sr.append(Boolean.toString(validateLinkOnEnter)); - sr.append(" validateLinkId=\""); - sr.append(modelFormField.getModelForm().getValidateLinkId()); - } else{ - sr.append("\" validateLinkOnEnter="); - sr.append(Boolean.toString(false)); - sr.append(" validateLinkId=\""); - } - // #Eam# validate-form sr.append("\" ajaxUrl=\""); sr.append(ajaxUrl); sr.append("\" ajaxEnabled="); @@ -1152,14 +1136,8 @@ public class MacroFormRenderer implement boolean ajaxEnabled = (updateAreas != null || UtilValidate.isNotEmpty(backgroundSubmitRefreshTarget)) && this.javaScriptEnabled; String ajaxUrl = ""; - String returnParams = ""; // #Eam# portletWidget if (ajaxEnabled) { - /* #Bam# portletWidget ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, null, context); - */ - returnParams = createReturnParamsFromUpdateAreas(updateAreas, context); - ajaxUrl = createAjaxParamsFromUpdateAreas(updateAreas, null, context, UtilValidate.isNotEmpty(returnParams)); - // #Eam# portletWidget } StringWriter sr = new StringWriter(); sr.append("<@renderSubmitField "); @@ -1195,10 +1173,6 @@ public class MacroFormRenderer implement if (ajaxEnabled) { sr.append(ajaxUrl); } - //#Bam# portletWidget - sr.append("\" returnParams =\""); - sr.append(returnParams); - //#Eam# portletWidget sr.append("\" />"); executeMacro(writer, sr.toString()); this.appendTooltip(writer, context, modelFormField); @@ -1772,7 +1746,6 @@ public class MacroFormRenderer implement public void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField) throws IOException { ModelFormField modelFormField = textFindField.getModelFormField(); - boolean validateLinkOnEnter = modelFormField.getModelForm().getValidateLinkOnEnter(); // #Eam# validate-form String defaultOption = textFindField.getDefaultOption(); String className = ""; String alert = "false"; @@ -1848,19 +1821,6 @@ public class MacroFormRenderer implement sr.append(maxlength); sr.append("\" autocomplete=\""); sr.append(autocomplete); - // #Bam# validate-form - if (validateLinkOnEnter) { - sr.append("\" validateLinkOnEnter="); - sr.append(Boolean.toString(validateLinkOnEnter)); - sr.append(" validateLinkId=\""); - sr.append(modelFormField.getModelForm().getValidateLinkId()); - } - else { - sr.append("\" validateLinkOnEnter="); - sr.append(Boolean.toString(false)); - sr.append(" validateLinkId=\""); - } - // #Eam# validate-form sr.append("\" titleStyle=\""); sr.append(titleStyle); sr.append("\" hideIgnoreCase="); @@ -2955,12 +2915,6 @@ public class MacroFormRenderer implement * @return Parameter string or empty string if no UpdateArea objects were found */ public String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context) { - // #Bam# portletWidget - return createAjaxParamsFromUpdateAreas(updateAreas, extraParams, context, false); - } - - public String createAjaxParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, String extraParams, Map<String, ? extends Object> context, boolean addReturnParams) { - // #Eam# portletWidget //FIXME copy from HtmlFormRenderer.java if (updateAreas == null) { return ""; @@ -2997,18 +2951,6 @@ public class MacroFormRenderer implement } } } - // #Bam# portletWidget - StringBuilder params = new StringBuilder(); - params.append(ajaxParams); - List<String> addingParams = UtilMisc.toList("portalPageId", "portalPortletId", "portletSeqId", "areaId", "idDescription"); - for (String addingParam : addingParams) { - if (UtilValidate.isNotEmpty(extraParams) && extraParams.contains(addingParam + "=")) { - continue; - } - WidgetWorker.addToParamsIfInContext(params, ctx, addingParam, parameters); - } - ajaxParams = params.toString(); - // #Eam# portletWidget //then add parameters from request. Those parameters could end with an anchor so we must set ajax parameters first if (UtilValidate.isNotEmpty(extraParams)) { if (ajaxParams.length() > 0 && !extraParams.startsWith("&")) { @@ -3019,47 +2961,10 @@ public class MacroFormRenderer implement ajaxUrl += updateArea.getAreaId() + ","; ajaxUrl += this.rh.makeLink(this.request, this.response, UtilHttp.removeQueryStringFromTarget(targetUrl)); ajaxUrl += "," + ajaxParams; - // #Bam# portletWidget - if (addReturnParams) { - if(updateArea.hasRedirParamList()){ - ajaxUrl += ",true"; - } else { - ajaxUrl += ",false"; - } - - } - // #Eam# portletWidget } Locale locale = UtilMisc.ensureLocale(context.get("locale")); return FlexibleStringExpander.expandString(ajaxUrl, context, locale); } - - // #Bam# portletWidget - public String createReturnParamsFromUpdateAreas(List<ModelForm.UpdateArea> updateAreas, Map<String, ? extends Object> context){ - String returnParam = ""; - boolean first = true; - for (ModelForm.UpdateArea updateArea : updateAreas) { - Map<String, Object> ctx = UtilGenerics.checkMap(context); - Map<String, String> redirectParameters = updateArea.getRedirParamList(ctx); - if(UtilValidate.isNotEmpty(redirectParameters)){ - for (String key : redirectParameters.keySet()) { - if(first){ - returnParam += "{'" + key + "' : '" + key + "'"; - first = false; - } - else{ - returnParam += ", '" + key + "' : '" + key + "'"; - } - } - } - } - if (UtilValidate.isNotEmpty(returnParam)) { - returnParam += "}"; - } - return returnParam; - } - // #Eam# portletWidget - /** Extracts parameters from a target URL string, prepares them for an Ajax * JavaScript call. This method is currently set to return a parameter string * suitable for the Prototype.js library. @@ -3213,10 +3118,6 @@ public class MacroFormRenderer implement sr.append(event); sr.append("\" action=\""); sr.append(action); - // #Bam# validate-form - sr.append("\" id=\""); - sr.append(modelFormField.getIdName()); - // #Eam# validate-form sr.append("\" imgSrc=\""); sr.append(imgSrc); sr.append("\" title=\""); @@ -3236,221 +3137,6 @@ public class MacroFormRenderer implement } } - //#Bam# portletWidget - // same as HtmlFormRenderer except when populate StringWriter sr - public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { - ModelFormField modelFormField = showPortletLink.getModelFormField(); - String linkStyle = ""; - //prepare show link properties - String id = ""; - - if (UtilValidate.isNotEmpty(modelFormField.getIdName())) { - id = modelFormField.getIdName(); - } - if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { - id = id + "_" + context.get("itemIndex"); - } - String markSelected = showPortletLink.getMarkSelected(context); - String event = ""; - if (UtilValidate.isNotEmpty(modelFormField.getEvent())) { - event = modelFormField.getEvent(); - } - String action = ""; - if (UtilValidate.isNotEmpty(modelFormField.getAction(context))) { - action = modelFormField.getAction(context); - } - String collapseScreenlet = showPortletLink.getCollapseScreenlet(context); - - String formName = modelFormField.getModelForm().getName(); - List<String> areasList = FastList.newInstance(); - List<String> targetList = FastList.newInstance(); - List<String> paramsList = FastList.newInstance(); - List<String> formList = FastList.newInstance(); - List<String> collapseLis = FastList.newInstance(); - - ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); - - for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ - - ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); - - if (UtilValidate.isEmpty(spiData.areaId) && - (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { - Debug.logWarning("The form [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); - } - - if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { - linkStyle = modelFormField.getWidgetStyle(); - } - collapseScreenlet = showPortletItem.getCollapseScreenlet(context); - - //check whether the current form field values should be appended to request parameters or not - List<String> appendFormParams = showPortletItem.getFormsToSerialize(); - areasList.add(spiData.areaId); - targetList.add(spiData.target); - paramsList.add(spiData.params.toString()); - String formParamsString = ""; - if(UtilValidate.isNotEmpty(appendFormParams) && appendFormParams.size() > 0){ - formParamsString = appendFormParams.toString(); - if (formParamsString.startsWith("{")) - formParamsString = formParamsString.replace("{", ""); - if (formParamsString.endsWith("}")) - formParamsString = formParamsString.replace("}", ""); - formParamsString = formParamsString.replace(", ", ","); - } - formList.add(formParamsString); - collapseLis.add(collapseScreenlet); - if(showPortletItem.getRequireConfirmation()) { - event = "onclick"; - action = "return confirm('" + showPortletItem.getConfirmationMessage(context) +"')"; - } - } - if (areasList.size() != targetList.size() - || areasList.size() != paramsList.size()) { - Debug.logWarning("The form Field [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has define a target and arameters list for each area it is going to refresh", module); - } - StringWriter sr = new StringWriter(); - sr.append("<@rerenderRefreshPortlet "); - sr.append("linkStyle=\""); - sr.append(linkStyle); - sr.append("\" event=\""); - sr.append(event); - sr.append("\" action=\""); - sr.append(action); - sr.append("\" areaId=\""); - sr.append(showPortletLink.listToString(areasList)); - sr.append("\" id=\""); - sr.append(id); - sr.append("\" formName=\""); - sr.append(formName); - sr.append("\" imgSrc=\""); - sr.append(splData.imgSrc); - sr.append("\" title=\""); - sr.append(splData.imgTitle); - - sr.append("\" alternate=\""); - sr.append(splData.alt); - sr.append("\" target=\""); - sr.append(showPortletLink.listToString(targetList)); - sr.append("\" appendFormParams=\""); - sr.append(showPortletLink.listToString(formList)); - sr.append("\" description=\""); - sr.append(splData.description); - sr.append("\" params=\""); - sr.append(showPortletLink.listToString(paramsList)); - sr.append("\" collapse=\""); - sr.append(Boolean.valueOf(collapseScreenlet).toString()); - sr.append("\" markSelected=\""); - sr.append(Boolean.valueOf(markSelected).toString()); - sr.append("\" />"); - executeMacro(writer, sr.toString()); - this.appendTooltip(writer, context, modelFormField); - } - //#Eam# portletWidget - // #Bam# portletWidget - public void makeShowPortletString(Appendable writer, String linkStyle, String targetArea, String target, String targetPortletId, Map<String, String> parameterMap, - String description, String collapse, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) - throws IOException { - - StringBuilder linkUrl = new StringBuilder(); - - String event = ""; - String action = ""; - String parameterKey = ""; - String parameterValue = ""; - String parameterList = ""; - String parameterForm = ""; - String collapseScreenlet = ""; - //String collapseScreenlet = collapse?"true":""; - - if (UtilValidate.isNotEmpty(modelFormField.getEvent()) && UtilValidate.isNotEmpty(modelFormField.getAction(context))) { - event = modelFormField.getEvent(); - action = modelFormField.getAction(context); - } - - Integer size = Integer.valueOf("0"); - - if( UtilValidate.isNotEmpty(description) && size > 0 && description.length() > size) { - description = description.substring(0, size - 8) + "..." + description.substring(description.length() - 5); - } - - if (UtilValidate.isNotEmpty(collapse)) { - collapseScreenlet = collapse; - } - - /* manage parameters-form and parameter */ - - Appendable localWriter = new StringWriter(); - boolean first = true; - if (UtilValidate.isNotEmpty(parameterMap)) { - //parameterForm = modelFormField.getModelForm().getName(); - for (Map.Entry<String, String> parameter: parameterMap.entrySet()) { - if (parameter.getValue() instanceof String) { - parameterKey = parameter.getKey(); - parameterValue = parameter.getValue(); - if(first){ - // targetPortletId is required for show-portlet - parameterList += "{'portalPortletId':'" + targetPortletId + "', '" + parameterKey + "':'" + parameterValue + "'"; - first = false; - } - else{ - parameterList += ", '" + parameterKey + "':'" + parameterValue + "'"; - } - } else { - Object parameterObject = parameter.getValue(); - - // skip null values - if (parameterObject == null){ - parameterForm = modelFormField.getModelForm().getName(); - } - else if (parameterObject instanceof String[]) { - // it's probably a String[], just get the first value - String[] parameterArray = (String[]) parameterObject; - parameterValue = parameterArray[0]; - Debug.logInfo("Found String array value for parameter [" + parameter.getKey() + "], using first value: " + parameterValue, module); - } else { - // not a String, and not a String[], just use toString - parameterValue = parameterObject.toString(); - } - } - } - if(!first){ // this means that we reached the end and the list wasn't void since we read a first element - parameterList += "}"; - } - } else { - linkUrl.append(localWriter.toString()); - } - - StringWriter sr = new StringWriter(); - sr.append("<@makeShowPortletString "); - sr.append("linkStyle=\""); - sr.append(linkStyle==null?"":linkStyle); - sr.append("\" id=\""); - sr.append(modelFormField.getIdName()); - sr.append("\" event=\""); - sr.append(event); - sr.append("\" action=\""); - sr.append(action); - sr.append("\" target=\""); - sr.append(target); - sr.append("\" targetArea=\""); - sr.append(targetArea); - sr.append("\" targetPortletId=\""); - sr.append(targetPortletId); - sr.append("\" description=\""); - sr.append(description); - sr.append("\" parameterForm=\""); - sr.append(parameterForm); - sr.append("\" parameterList=\""); - sr.append(parameterList); - sr.append("\" collapse=\""); - sr.append(collapseScreenlet); - - sr.append("\" />"); - executeMacro(writer, sr.toString()); - } - // #Eam# portletWidget - public void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, String confirmation , ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException { if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) { String hiddenFormName = WidgetWorker.makeLinkHiddenFormName(context, modelFormField); Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sat Aug 4 18:11:00 2012 @@ -89,7 +89,6 @@ public class ModelForm extends ModelWidg protected String tooltip; protected String listName; protected String listEntryName; - protected String validateLinkId; // #Eam# validateForm protected FlexibleMapAccessor<Map<String, ? extends Object>> defaultMapName; protected String defaultEntityName; protected String defaultServiceName; @@ -116,7 +115,6 @@ public class ModelForm extends ModelWidg protected boolean separateColumns = false; protected boolean groupColumns = true; protected boolean useRowSubmit = false; - protected boolean validateLinkOnEnter = false; // #Eam# validateForm protected FlexibleStringExpander targetWindowExdr; protected String defaultRequiredFieldStyle; protected String defaultSortFieldStyle; @@ -275,7 +273,6 @@ public class ModelForm extends ModelWidg this.tooltip = parent.tooltip; this.listName = parent.listName; this.listEntryName = parent.listEntryName; - this.validateLinkId = parent.validateLinkId;// #Eam# validateForm this.tooltip = parent.tooltip; this.defaultEntityName = parent.defaultEntityName; this.defaultServiceName = parent.defaultServiceName; @@ -490,15 +487,6 @@ public class ModelForm extends ModelWidg this.rowCountExdr = FlexibleStringExpander.getInstance(formElement.getAttribute("row-count")); } - //#Bam# : validateForm - if (this.validateLinkId == null || formElement.hasAttribute("validate-link-id")) { - this.validateLinkId = formElement.getAttribute("validate-link-id"); - } - if ( formElement.hasAttribute("validate-link-on-enter")) { - this.validateLinkOnEnter = "true".equalsIgnoreCase(formElement.getAttribute("validate-link-on-enter")); - } - //#Eam# : validateForm - //alt-row-styles for (Element altRowStyleElement : UtilXml.childElementList(formElement, "alt-row-style")) { AltRowStyle altRowStyle = new AltRowStyle(altRowStyleElement); @@ -849,10 +837,7 @@ public class ModelForm extends ModelWidg */ public void renderFormString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { // increment the paginator, only for list and multi forms - Boolean PAGINATOR_AND_ACTION_DONE = null; // #Eam# screenlet navigationForm if ("list".equals(this.type) || "multi".equals(this.type)) { - Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext")); // #Eam# screenlet navigationForm - PAGINATOR_AND_ACTION_DONE = (Boolean) globalCtx.get("NO_PAGINATOR"); // #Eam# screenlet navigationForm WidgetWorker.incrementPaginatorNumber(context); } @@ -865,9 +850,7 @@ public class ModelForm extends ModelWidg context.put("viewIndex", this.getViewIndex(context)); context.put("viewSize", this.getViewSize(context)); - if (UtilValidate.isEmpty(PAGINATOR_AND_ACTION_DONE)) { // #Eam# screenlet navigationForm - runFormActions(context); - } // #Eam# screenlet navigationForm + runFormActions(context); // if this is a list form, don't useRequestParameters if ("list".equals(this.type) || "multi".equals(this.type)) { @@ -1258,11 +1241,7 @@ public class ModelForm extends ModelWidg continue; } - /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { - */ - if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { - // #Eam# portletWidget inputFieldFound = true; continue; } @@ -1286,11 +1265,7 @@ public class ModelForm extends ModelWidg } // skip all of the display/hyperlink fields - /* #Bam# portletWidget if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK) { - */ - if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK || fieldInfo.getFieldType() == ModelFormField.FieldInfo.SHOW_PORTLET) { - // #Eam# portletWidget continue; } @@ -1534,6 +1509,9 @@ public class ModelForm extends ModelWidg if (itemIndex < lowIndex) { continue; } + + // reset/remove the BshInterpreter now as well as later because chances are there is an interpreter at this level of the stack too + this.resetBshInterpreter(context); Map<String, Object> itemMap = UtilGenerics.checkMap(item); MapStack<String> localContext = MapStack.create(context); @@ -1620,11 +1598,7 @@ public class ModelForm extends ModelWidg continue; } - /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { - */ - if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { - // #Eam# portletWidget // okay, now do the form cell break; } @@ -1648,11 +1622,7 @@ public class ModelForm extends ModelWidg } // skip all of the display/hyperlink fields - /* #Bam# portletWidget if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK) { - */ - if (fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.DISPLAY_ENTITY || fieldInfo.getFieldType() == ModelFormField.FieldInfo.HYPERLINK || fieldInfo.getFieldType() == ModelFormField.FieldInfo.SHOW_PORTLET) { - // #Bam# portletWidget continue; } @@ -1674,11 +1644,7 @@ public class ModelForm extends ModelWidg } // skip all non-display and non-hyperlink fields - /* #Bam# portletWidget if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK) { - */ - if (fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.DISPLAY_ENTITY && fieldInfo.getFieldType() != ModelFormField.FieldInfo.HYPERLINK && fieldInfo.getFieldType() != ModelFormField.FieldInfo.SHOW_PORTLET) { - // #Eam# portletWidget continue; } @@ -2740,16 +2706,6 @@ public class ModelForm extends ModelWidg return this.useRowSubmit; } - //#Bam# : validateForm - public boolean getValidateLinkOnEnter() { - return this.validateLinkOnEnter; - } - - public String getValidateLinkId() { - return this.validateLinkId; - } - //#Eam# : validateForm - public List<ModelFormField> getMultiSubmitFields() { return this.multiSubmitFields; } @@ -2883,7 +2839,6 @@ public class ModelForm extends ModelWidg protected String areaId; protected String areaTarget; List<WidgetWorker.Parameter> parameterList =FastList.newInstance(); - List<WidgetWorker.Parameter> redirParameterList =FastList.newInstance(); // #Eam# portletWidget /** XML constructor. * @param updateAreaElement The <code><on-xxx-update-area></code> * XML element. @@ -2896,12 +2851,6 @@ public class ModelForm extends ModelWidg for (Element parameterElement: parameterElementList) { this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); } - // #Bam# portletWidget - parameterElementList = UtilXml.childElementList(updateAreaElement, "redirect-parameter"); - for (Element parameterElement: parameterElementList) { - this.redirParameterList.add(new WidgetWorker.Parameter(parameterElement)); - } - // #Eam# portletWidget } /** String constructor. * @param areaId The id of the widget element to be updated @@ -2932,25 +2881,6 @@ public class ModelForm extends ModelWidg public Map<String, String> getParameterMap(Map<String, Object> context) { Map<String, String> fullParameterMap = FastMap.newInstance(); for (WidgetWorker.Parameter parameter: this.parameterList) { - // #Bam# portletWidget : add property sendIfEmpty in parameters - String paramValue = parameter.getValue(context); - if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ - fullParameterMap.put(parameter.getName(), parameter.getValue(context)); - } - // #Eam# portletWidget - } - - return fullParameterMap; - } - // #Bam# portletWidget - public boolean hasRedirParamList() { - return UtilValidate.isNotEmpty(this.redirParameterList); - } - - public Map<String, String> getRedirParamList(Map<String, Object> context) { - Map<String, String> fullParameterMap = FastMap.newInstance(); - for (WidgetWorker.Parameter parameter: this.redirParameterList) { - // #Eam# portletWidget fullParameterMap.put(parameter.getName(), parameter.getValue(context)); } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Sat Aug 4 18:11:00 2012 @@ -273,37 +273,31 @@ public abstract class ModelFormAction { } public static class Script extends ModelFormAction { - protected FlexibleStringExpander scriptLocationExdr; + protected String location; + protected String method; public Script(ModelForm modelForm, Element scriptElement) { super (modelForm, scriptElement); - this.scriptLocationExdr = FlexibleStringExpander.getInstance(scriptElement.getAttribute("location")); + String scriptLocation = scriptElement.getAttribute("location"); + this.location = WidgetWorker.getScriptLocation(scriptLocation); + this.method = WidgetWorker.getScriptMethodName(scriptLocation); } @Override public void runAction(Map<String, Object> context) { - Locale locale = (Locale) context.get("locale"); - String scriptLocation = this.scriptLocationExdr.expandString(context, locale); - String location = WidgetWorker.getScriptLocation(scriptLocation); - String method = WidgetWorker.getScriptMethodName(scriptLocation); if (location.endsWith(".xml")) { + Map<String, Object> localContext = FastMap.newInstance(); + localContext.putAll(context); DispatchContext ctx = this.modelForm.dispatchContext; - MethodContext methodContext = new MethodContext(ctx, context); + MethodContext methodContext = new MethodContext(ctx, localContext, null); try { SimpleMethod.runSimpleMethod(location, method, methodContext); - Map<String, Object> resultContext = methodContext.getEnv("widget"); - if (UtilValidate.isNotEmpty(resultContext)){ - context.putAll(resultContext); - } - Map<String, Object> parametersUp = methodContext.getParameters(); - if (UtilValidate.isNotEmpty(parametersUp)){ - context.put("parameters",parametersUp); - } + context.putAll(methodContext.getResults()); } catch (MiniLangException e) { throw new IllegalArgumentException("Error running simple method at location [" + location + "]", e); } } else { - ScriptUtil.executeScript(location, method, context); + ScriptUtil.executeScript(this.location, this.method, context); } } } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Sat Aug 4 18:11:00 2012 @@ -48,7 +48,6 @@ import org.ofbiz.base.util.UtilFormatOut import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; -import org.ofbiz.base.util.UtilURL;// #Eam# portletWidget import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; @@ -68,7 +67,6 @@ import org.ofbiz.service.DispatchContext import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.ModelParam; import org.ofbiz.service.ModelService; -import org.ofbiz.widget.ModelWidget; // #Eam# portletWidget import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.form.ModelForm.UpdateArea; import org.w3c.dom.Element; @@ -118,7 +116,6 @@ public class ModelFormField { protected Boolean sortField = null; protected String headerLink; protected String headerLinkStyle; - protected ShowPortletLink showPortletLink = null;// #Eam# portletWidget /** On Change Event areas to be updated. */ protected List<UpdateArea> onChangeUpdateAreas; @@ -207,15 +204,6 @@ public class ModelFormField { else if ("image".equals(subElementName)) this.fieldInfo = new ImageField(subElement, this); else if ("container".equals(subElementName)) this.fieldInfo = new ContainerField(subElement, this); else if ("on-field-event-update-area".equals(subElementName)) addOnEventUpdateArea(new UpdateArea(subElement)); - // #Bam# portletWidget - else if ("show-portlet".equals(subElementName)) { - if (this.showPortletLink == null) { - this.showPortletLink = new ShowPortletLink(subElement, this); - this.fieldInfo = this.showPortletLink; - } - addShowPortletTolink(subElement, this); - } - // #Eam# portletWidget else throw new IllegalArgumentException("The field sub-element with name " + subElementName + " is not supported"); } } @@ -227,13 +215,6 @@ public class ModelFormField { else if ("click".equals(updateArea.getEventType())) addOnClickUpdateArea(updateArea); } - // #Bam# portletWidget - public void addShowPortletTolink(Element element, ModelFormField modelFormField) { - ShowPortletLink showLink = modelFormField.getShowPortletLink(); - showLink.addShowPorletTolink(element); - } - // #Eam# portletWidget - protected void addOnChangeUpdateArea(UpdateArea updateArea) { if (onChangeUpdateAreas == null) onChangeUpdateAreas = FastList.newInstance(); onChangeUpdateAreas.add(updateArea); @@ -276,11 +257,6 @@ public class ModelFormField { if (overrideFormField.onChangeUpdateAreas != null) this.onChangeUpdateAreas = overrideFormField.onChangeUpdateAreas; if (overrideFormField.onClickUpdateAreas != null) this.onClickUpdateAreas = overrideFormField.onClickUpdateAreas; this.encodeOutput = overrideFormField.encodeOutput; - // #Bam# portletWidget - if (overrideFormField.showPortletLink != null) { - this.showPortletLink = overrideFormField.showPortletLink; - } - // #Eam# portletWidget } public boolean induceFieldInfo(String defaultFieldType) { @@ -555,12 +531,6 @@ public class ModelFormField { return onClickUpdateAreas; } - // #Bam# portletWidget - public ShowPortletLink getShowPortletLink() { - return showPortletLink; - } - // #Eam# portletWidget - public FieldInfo getFieldInfo() { return fieldInfo; } @@ -1307,7 +1277,6 @@ public class ModelFormField { public static final int PASSWORD = 18; public static final int IMAGE = 19; public static final int DISPLAY_ENTITY = 20; - public static final int SHOW_PORTLET = 22; // #Eam# portletWidget // the numbering here represents the priority of the source; //when setting a new fieldInfo on a modelFormField it will only set @@ -1341,7 +1310,6 @@ public class ModelFormField { fieldTypeByName.put("image", Integer.valueOf(19)); fieldTypeByName.put("display-entity", Integer.valueOf(20)); fieldTypeByName.put("container", Integer.valueOf(21)); - fieldTypeByName.put("show-portlet", Integer.valueOf(22));// #Eam# portletWidget } protected int fieldType; @@ -2424,373 +2392,6 @@ public class ModelFormField { } } - // #Bam# portletWidget - public static class ShowPortletLink extends FieldInfo implements ModelWidget.ShowPortletLink { - - protected FlexibleStringExpander description; - protected FlexibleStringExpander imageTitle; - protected FlexibleStringExpander alternate; - protected FlexibleStringExpander collapseScreenlet; - protected FlexibleStringExpander markSelected; - protected FlexibleStringExpander image; - protected String size; - protected List<ShowPortletItem> showPortletItems = FastList.newInstance(); - - public String listToString(List<String> list) { - String result = ""; - for(String s : list) { - if (UtilValidate.isNotEmpty(s)) { - result = result.concat(s).concat(";"); - } - } - if (result.endsWith(";")) - return result.substring(0, result.length()-1); - return result; - } - - public ShowPortletLink(Element element, ModelFormField modelFormField) { - super(element, modelFormField); - } - - public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { - formStringRenderer.renderShowPortletLink(writer, context, this); - } - - public void addShowPorletTolink(Element element) { - showPortletItems.add(new ShowPortletItem(element, this)); - } - - /** - * @param string - */ - public void setDescription(String string) { - if(UtilValidate.isNotEmpty(string)) { - this.description = FlexibleStringExpander.getInstance(string); - } - } - - /** - * @param string - */ - public void setImageTitle(String string) { - if(UtilValidate.isNotEmpty(string)) { - this.imageTitle = FlexibleStringExpander.getInstance(string); - } - } - - public List<ShowPortletItem> getShowPortletItems(){ - return showPortletItems; - } - - /** - * @param string - */ - public void setAlternate(String string) { - if(UtilValidate.isNotEmpty(string)) { - this.alternate = FlexibleStringExpander.getInstance(string); - } - } - - public String getDescription(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(description)) { - return this.description.expandString(context); - } - return ""; - } - - public String getAlternate(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(alternate)) { - return this.alternate.expandString(context); - } - return ""; - } - - public String getImageTitle(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(imageTitle)) { - return this.imageTitle.expandString(context); - } - return ""; - } - public String getImage(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(imageTitle)) { - return this.image.expandString(context); - } - return ""; - } - - public String getSize() { - return this.size; - } - - public String setSize(String size) { - return this.size = size; - } - - public void setCollapseScreenlet(String collapseScreenlet) { - this.collapseScreenlet = FlexibleStringExpander.getInstance(collapseScreenlet); - } - - public void setMarkSelected(String markSelected) { - this.markSelected = FlexibleStringExpander.getInstance(markSelected); - } - - public String getCollapseScreenlet(Map<String, Object> context) { - String areaIdValue = ""; - if (UtilValidate.isNotEmpty(collapseScreenlet)) { - areaIdValue = this.collapseScreenlet.expandString(context); - } - return areaIdValue; - } - - public String getMarkSelected(Map<String, Object> context) { - String value = ""; - if (UtilValidate.isNotEmpty(markSelected)) { - value = this.markSelected.expandString(context); - } - return value; - } - } - - public static class ShowPortletItem implements ModelWidget.ShowPortletItem { - - protected FlexibleStringExpander areaId; - protected FlexibleStringExpander target; - protected ShowPortletLink showPortletLink; - protected FlexibleStringExpander portletId; - protected boolean requireConfirmation; - protected FlexibleStringExpander confirmationMessage; - protected FlexibleStringExpander portalPageId; - protected FlexibleStringExpander portletSeqId; - protected List<String> formsToSerialize = FastList.newInstance(); - protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); - protected FlexibleMapAccessor<Map<String, String>> parametersMapAcsr; - - public ShowPortletItem(Element element, ShowPortletLink showPortletLink) { - this.showPortletLink = showPortletLink; - this.setConfirmationMessage(element.getAttribute("confirmation-message")); - this.setRequireConfirmation(("true".equals(element.getAttribute("request-confirmation")))); - this.setAreaId(element.getAttribute("area-id")); - this.setPortletId(element.getAttribute("portlet-id")); - this.setPortalPageId(element.getAttribute("portal-page-id")); - this.setPortletSeqId(element.getAttribute("portlet-seq-id")); - this.setDescription(element.getAttribute("description")); - this.setAlternate(element.getAttribute("alternate")); - this.setImageTitle(element.getAttribute("image-title")); - this.setTarget(element.getAttribute("target")); - this.setImage (element.getAttribute("image-location")); - this.parametersMapAcsr = FlexibleMapAccessor.getInstance(element.getAttribute("parameters-map")); - this.setSize(element.getAttribute("size")); - this.setCollapseScreenlet(element.getAttribute("collapse-screenlet")); - this.setMarkSelected(element.getAttribute("mark-selected")); - - List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter"); - for (Element parameterElement: parameterElementList) { - this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); - } - List<? extends Element> parametersFroms = UtilXml.childElementList(element, "parameters-form"); - for (Element parameterForm: parametersFroms) { - String formName = parameterForm.getAttribute("form-name"); - if (UtilValidate.isEmpty(formName)) { - formName = this.getModelFormField().getModelForm().getName(); - } - if (!formsToSerialize.contains(formName)) { - formsToSerialize.add(formName); - } - } - } - - public ModelFormField getModelFormField() { - return showPortletLink.getModelFormField(); - } - -// public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException { -// formStringRenderer.renderShowPortletLink(writer, context, this); -// } - - public List<String> getFormsToSerialize() { - return this.formsToSerialize; - } - - public String getDescription(Map<String, Object> context) { - return showPortletLink.getDescription(context); - } - - public String getPortalPageId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portalPageId)) { - return this.portalPageId.expandString(context); - } - return ""; - } - - public String getPortletId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portletId)) { - return this.portletId.expandString(context); - } - return ""; - } - - public String getPortletSeqId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portletSeqId)) { - return this.portletSeqId.expandString(context); - } - return ""; - } - - public String getConfirmationMessage(Map<String, Object> context) { - String areaIdValue = ""; - if (UtilValidate.isNotEmpty(confirmationMessage)) { - areaIdValue = this.confirmationMessage.expandString(context); - } - return areaIdValue; - } - - public void setRequireConfirmation(boolean reqConfirm) { - requireConfirmation = reqConfirm; - } - - public boolean getRequireConfirmation() { - return requireConfirmation; - } - - public String getAreaId(Map<String, Object> context) { - String areaIdValue = ""; - if (UtilValidate.isNotEmpty(areaId)) { - areaIdValue = this.areaId.expandString(context); - } - return areaIdValue; - } - public String getCollapseScreenlet(Map<String, Object> context) { - return showPortletLink.getCollapseScreenlet(context); - } - - public String getAlternate(Map<String, Object> context) { - return showPortletLink.getAlternate(context); - } - - public String getImageTitle(Map<String, Object> context) { - return showPortletLink.getImageTitle(context); - } - - public String getTarget(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(target)) { - return this.target.expandString(context); - } - return ""; - } - - public Map<String, String> getParameterMap(Map<String, Object> context) { - Map<String, String> fullParameterMap = FastMap.newInstance(); - Map<String, String> addlParamMap = this.parametersMapAcsr.get(context); - if (addlParamMap != null) { - fullParameterMap.putAll(addlParamMap); - } - for (WidgetWorker.Parameter parameter: this.parameterList) { - String paramValue = parameter.getValue(context); - if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ - if ("idDescription".equals(parameter.getName())) { - if (UtilValidate.isNotEmpty(paramValue)) { - paramValue = UtilURL.removeBadCharForUrl(paramValue); - fullParameterMap.put(parameter.getName(), paramValue); - } - } - else { - fullParameterMap.put(parameter.getName(), paramValue); - } - } - } - return fullParameterMap; - } - - public String getImage(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(target)) { - return this.showPortletLink.image.expandString(context); - } - return ""; - } - - public void setImage(String image) { - showPortletLink.image = FlexibleStringExpander.getInstance(image); - } - - public String getSize() { - return showPortletLink.size; - } - - public void setSize(String size) { - showPortletLink.setSize(size); - } - - /** - * @param string - */ - public void setAreaId(String areaId) { - this.areaId = FlexibleStringExpander.getInstance(areaId); - } - - /** - * @param string - */ - public void setPortletId(String portletId) { - this.portletId = FlexibleStringExpander.getInstance(portletId); - } - - /** - * @param string - */ - public void setPortletSeqId(String portletSeqId) { - this.portletSeqId = FlexibleStringExpander.getInstance(portletSeqId); - } - - public void setCollapseScreenlet(String collapseScreenlet) { - if(UtilValidate.isEmpty(showPortletLink.collapseScreenlet) && UtilValidate.isNotEmpty(collapseScreenlet)) - showPortletLink.setCollapseScreenlet(collapseScreenlet); - } - - public void setMarkSelected(String markSelected) { - if(UtilValidate.isEmpty(showPortletLink.markSelected) && UtilValidate.isNotEmpty(markSelected)) - showPortletLink.setMarkSelected(markSelected); - } - - /** - * @param string - */ - public void setPortalPageId(String portalPageId) { - this.portalPageId = FlexibleStringExpander.getInstance(portalPageId); - } - - /** - * @param string - */ - public void setDescription(String string) { - showPortletLink.setDescription(string); - } - - /** - * @param string - */ - public void setImageTitle(String string) { - showPortletLink.setImageTitle(string); - } - - /** - * @param string - */ - public void setAlternate(String string) { - showPortletLink.setAlternate(string); - } - - /** - * @param string - */ - public void setTarget(String string) { - this.target = FlexibleStringExpander.getInstance(string); - } - public void setConfirmationMessage(String string) { - this.confirmationMessage = FlexibleStringExpander.getInstance(string); - } - } - // #Eam# portletWidget - public static class SubHyperlink { protected FlexibleStringExpander useWhen; protected String linkType; Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Sat Aug 4 18:11:00 2012 @@ -47,8 +47,6 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; -import org.ofbiz.widget.ModelWidget.ShowPortletItemData; //#Eam# portletWidget -import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; //#Eam# portletWidget import org.ofbiz.widget.form.FormStringRenderer; import org.ofbiz.widget.form.ModelForm; import org.ofbiz.widget.form.ModelFormField; @@ -69,8 +67,6 @@ import org.ofbiz.widget.form.ModelFormFi import org.ofbiz.widget.form.ModelFormField.RadioField; import org.ofbiz.widget.form.ModelFormField.RangeFindField; import org.ofbiz.widget.form.ModelFormField.ResetField; -import org.ofbiz.widget.form.ModelFormField.ShowPortletItem; //#Eam# portletWidget -import org.ofbiz.widget.form.ModelFormField.ShowPortletLink; //#Eam# portletWidget import org.ofbiz.widget.form.ModelFormField.SubmitField; import org.ofbiz.widget.form.ModelFormField.TextField; import org.ofbiz.widget.form.ModelFormField.TextFindField; @@ -1609,7 +1605,7 @@ public class HtmlFormRenderer extends Ht public void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException { Integer itemIndex = (Integer)context.get("itemIndex"); - writer.append(" <tr id=\"" + modelForm.getName() + "_row_" +itemIndex+"\""); //#Eam# portletWidget : add id + writer.append(" <tr"); if (itemIndex!=null) { String altRowStyles = modelForm.getStyleAltRowStyle(context); @@ -2992,119 +2988,4 @@ public class HtmlFormRenderer extends Ht } return ajaxUrl.toString(); } - //#Bam# portletWidget - // same as MacroFormRenderer except when populate writer - public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { - ModelFormField modelFormField = showPortletLink.getModelFormField(); - String linkStyle = ""; - //prepare show link properties - String id = ""; - - if (UtilValidate.isNotEmpty(modelFormField.getIdName())) { - id = modelFormField.getIdName(); - } - if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { - id = id + "_" + context.get("itemIndex"); - } - String markSelected = showPortletLink.getMarkSelected(context); - String event = ""; - if (UtilValidate.isNotEmpty(modelFormField.getEvent())) { - event = modelFormField.getEvent(); - } - String action = ""; - if (UtilValidate.isNotEmpty(modelFormField.getAction(context))) { - action = modelFormField.getAction(context); - } - String collapseScreenlet = showPortletLink.getCollapseScreenlet(context); - - String formName = modelFormField.getModelForm().getName(); - List<String> areasList = FastList.newInstance(); - List<String> targetList = FastList.newInstance(); - List<String> paramsList = FastList.newInstance(); - List<String> formList = FastList.newInstance(); - List<String> collapseLis = FastList.newInstance(); - - ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); - - for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ - - ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); - - if (UtilValidate.isEmpty(spiData.areaId) && - (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { - Debug.logWarning("The form [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); - } - - if (UtilValidate.isNotEmpty(modelFormField.getWidgetStyle())) { - linkStyle = modelFormField.getWidgetStyle(); - } - collapseScreenlet = showPortletItem.getCollapseScreenlet(context); - - //check whether the current form field values should be appended to request parameters or not - List<String> appendFormParams = showPortletItem.getFormsToSerialize(); - areasList.add(spiData.areaId); - targetList.add(spiData.target); - paramsList.add(spiData.params.toString()); - String formParamsString = ""; - if(UtilValidate.isNotEmpty(appendFormParams) && appendFormParams.size() > 0){ - formParamsString = appendFormParams.toString(); - if (formParamsString.startsWith("{")) - formParamsString = formParamsString.replace("{", ""); - if (formParamsString.endsWith("}")) - formParamsString = formParamsString.replace("}", ""); - formParamsString = formParamsString.replace(", ", ","); - } - formList.add(formParamsString); - collapseLis.add(collapseScreenlet); - } - if (areasList.size() != targetList.size() - || areasList.size() != paramsList.size()) { - Debug.logWarning("The form Field [" + modelFormField.getModelForm().getFormLocation() + "#" + modelFormField.getModelForm().getName() +"] has define a target and arameters list for each area it is going to refresh", module); - } - if(UtilValidate.isNotEmpty(id)) { - writer.append("<div id=\"" + id +"_div\""); - } - writer.append(">\n"); - writer.append(" <a "); - if(UtilValidate.isNotEmpty(linkStyle)) { - writer.append(" class=\"" + linkStyle +"\""); - } - writer.append(" href='javascript:refrshPortlet(\"" + showPortletLink.listToString(targetList) +"\", "); - writer.append("\"" + showPortletLink.listToString(areasList) + "\", "); - writer.append("\"" + showPortletLink.listToString(paramsList) + "\", "); - writer.append("\"" + formName +"\", "); - writer.append("\"" + showPortletLink.listToString(formList) + "\", "); - if (UtilValidate.isNotEmpty(showPortletLink.getCollapseScreenlet(context))) { - writer.append("\"" + showPortletLink.getCollapseScreenlet(context) + "\", "); - writer.append("\"" + id + "_div\", "); - } - else { - writer.append("\"\", "); - writer.append("\"\", "); - } - if (UtilValidate.isNotEmpty(showPortletLink.getCollapseScreenlet(context))) { - writer.append("\"" + markSelected + "\")'"); - } - else { - writer.append("\"\")' "); - } - if(UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - writer.append(event + "=\"" + action + "\" "); - } - if(UtilValidate.isNotEmpty(splData.imgSrc) && UtilValidate.isNotEmpty(splData.imgTitle)) { - writer.append("title=\"" + splData.imgTitle+ "\""); - } - writer.append(">"); - if(UtilValidate.isNotEmpty(splData.imgSrc)) { - writer.append("<img src=\"" + splData.imgSrc +"\" alt=\"" + splData.alt + "\" title=\"" + splData.imgTitle +"\"/>"); - } - writer.append(splData.description); - writer.append("</a>"); - if(UtilValidate.isNotEmpty(id)) { - writer.append("</div>"); - } - - this.appendTooltip(writer, context, modelFormField); - } - //#Eam# portletWidget } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Sat Aug 4 18:11:00 2012 @@ -28,7 +28,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.ofbiz.base.util.Debug; //#Eam# portletWidget import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; @@ -38,19 +37,11 @@ import org.ofbiz.webapp.control.RequestH import org.ofbiz.webapp.taglib.ContentUrlTag; import org.ofbiz.widget.ModelWidget; import org.ofbiz.widget.WidgetWorker; -//#Bam# portletWidget -import org.ofbiz.widget.ModelWidget.ShowPortletItemData; -import org.ofbiz.widget.ModelWidget.ShowPortletLinkData; -//#Eam# portletWidget import org.ofbiz.widget.menu.MenuStringRenderer; import org.ofbiz.widget.menu.ModelMenu; import org.ofbiz.widget.menu.ModelMenuItem; import org.ofbiz.widget.menu.ModelMenuItem.Image; import org.ofbiz.widget.menu.ModelMenuItem.Link; -//#Bam# portletWidget -import org.ofbiz.widget.menu.ModelMenuItem.ShowPortletItem; -import org.ofbiz.widget.menu.ModelMenuItem.ShowPortletLink; -//#Bam# portletWidget /** * Widget Library - HTML Menu Renderer implementation @@ -190,15 +181,9 @@ public class HtmlMenuRenderer extends Ht writer.append(">"); Link link = menuItem.getLink(); - ShowPortletLink showPortletLink = menuItem.getShowPortletLink(); //#Eam# portletWidget //if (Debug.infoOn()) Debug.logInfo("in HtmlMenuRendererImage, link(0):" + link,""); if (link != null) { renderLink(writer, context, link); - //#Bam# portletWidget - } - else if(showPortletLink != null){ - renderShowPortletLink(writer, context, showPortletLink); - //#Eam# portletWidget } else { String txt = menuItem.getTitle(context); StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder"); @@ -580,14 +565,6 @@ public class HtmlMenuRenderer extends Ht writer.append(border); writer.append("\""); } - //#Bam# portletWidget - String title = image.getTitle(context); - if (UtilValidate.isNotEmpty(title)) { - writer.append(" title=\""); - writer.append(title); - writer.append("\""); - } - //#Eam# portletWidget String src = image.getSrc(context); if (UtilValidate.isNotEmpty(src)) { writer.append(" src=\""); @@ -621,63 +598,4 @@ public class HtmlMenuRenderer extends Ht } writer.append("/>"); } - //#Bam# portletWidget - public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ShowPortletLink showPortletLink) throws IOException { - ModelMenuItem modelMenuItem = showPortletLink.getModelMenuItem(); - String linkStyle = ""; - //prepare show link properties - String id = ""; - String event = ""; - String action = ""; - if (UtilValidate.isNotEmpty(context.get("itemIndex"))) { - id = id + context.get("itemIndex"); - } - StringBuilder areaCsvString = new StringBuilder(); - - ShowPortletLinkData splData = WidgetWorker.prepareShowPortletLinkData(showPortletLink, context); - - for(ShowPortletItem showPortletItem : showPortletLink.getShowPortletItems()){ - - ShowPortletItemData spiData = WidgetWorker.prepareShowPortletItemsData(showPortletItem, context); - - if(showPortletItem.getRequireConfirmation() && UtilValidate.isNotEmpty(showPortletItem.getConfirmationMessage(context))) { - event = "onclick"; - action = "return confirm('" + showPortletItem.getConfirmationMessage(context) +"')"; - } - - if (UtilValidate.isEmpty(spiData.areaId) && - (UtilValidate.isEmpty(spiData.portalPageId) || UtilValidate.isEmpty(spiData.portletId) || UtilValidate.isEmpty(spiData.portletSeqId))) { - Debug.logWarning("The menu [" + modelMenuItem.getModelMenu().getBoundaryCommentName() +"] has a show-portlet field that should define a target-area or must have target-page-id, target-portlet-id and target-seq_id attributes", module); - } - - if (UtilValidate.isNotEmpty(modelMenuItem.getWidgetStyle())) { - linkStyle = modelMenuItem.getWidgetStyle(); - } - - if (UtilValidate.isNotEmpty( spiData.areaId )) { - StringBuilder areanElement = new StringBuilder(); - areanElement.append(spiData.areaId).append(",").append(spiData.target).append(",").append(spiData.params); - if (UtilValidate.isNotEmpty( areaCsvString )) { - areaCsvString.append(","); - } - areaCsvString.append(areanElement); - } - } - - writer.append(" <a "); - if (UtilValidate.isNotEmpty(event) && UtilValidate.isNotEmpty(action)) { - writer.append(event + "=\"" + action +"\""); - } - if(UtilValidate.isNotEmpty(linkStyle)) { - writer.append(" class=\"" + linkStyle +"\""); - } - writer.append(" href=\"javascript:ajaxUpdateAreas(\'" + areaCsvString.toString() + "\');\" "); - writer.append(">"); - if(UtilValidate.isNotEmpty(splData.imgSrc)) { - writer.append("<img src=\"" + splData.imgSrc +"\" alt=\"" + splData.alt + "\" title=\"" + splData.imgTitle +"\"/>"); - } - writer.append(splData.description); - writer.append("</a>"); - } - //#Eam# portletWidget } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java Sat Aug 4 18:11:00 2012 @@ -35,5 +35,4 @@ public interface MenuStringRenderer { public void setUserLoginIdHasChanged(boolean b) throws IOException ; public void renderLink(Appendable writer, Map<String, Object> context, ModelMenuItem.Link link) throws IOException ; public void renderImage(Appendable writer, Map<String, Object> context, ModelMenuItem.Image image) throws IOException ; - public void renderShowPortletLink(Appendable writer, Map<String, Object> context, ModelMenuItem.ShowPortletLink showPortletLink) throws IOException ; } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Sat Aug 4 18:11:00 2012 @@ -39,7 +39,6 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.minilang.operation.BaseCompare; import org.ofbiz.security.Security; -import org.ofbiz.security.authz.Authorization; import org.ofbiz.service.DispatchContext; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; @@ -310,18 +309,15 @@ public class ModelMenuCondition { if (userLogin != null) { String permission = permissionExdr.expandString(context); String action = actionExdr.expandString(context); - - Authorization authz = (Authorization) context.get("authz"); Security security = (Security) context.get("security"); if (UtilValidate.isNotEmpty(action)) { - //Debug.logWarning("Deprecated method hasEntityPermission() was called; the action field should no longer be used", module); // run hasEntityPermission if (security.hasEntityPermission(permission, action, userLogin)) { return true; } } else { // run hasPermission - if (authz.hasPermission(userLogin.getString("userLoginId"), permission, context)) { + if (security.hasPermission(permission, userLogin)) { return true; } } Modified: ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1369382&r1=1369381&r2=1369382&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Sat Aug 4 18:11:00 2012 @@ -35,13 +35,11 @@ import org.ofbiz.base.util.StringUtil; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.base.util.UtilURL; // #Eam# portletWidget import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericValue; import org.ofbiz.entityext.permission.EntityPermissionChecker; -import org.ofbiz.widget.ModelWidget; // #Eam# portletWidget import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.PortalPageWorker; import org.w3c.dom.Element; @@ -55,7 +53,6 @@ public class ModelMenuItem { public static final String module = ModelMenuItem.class.getName(); protected ModelMenu modelMenu; - protected ShowPortletLink showPortletLink;// #Eam# portletWidget protected Map<String, Object> dataMap = new HashMap<String, Object>(); protected String name; @@ -190,15 +187,7 @@ public class ModelMenuItem { if (actionsElement != null) { this.actions = ModelMenuAction.readSubActions(this, actionsElement); } - // #Bam# portletWidget - List<? extends Element> showPortlets = UtilXml.childElementList(fieldElement, "show-portlet"); - for (Element showPortlet: showPortlets) { - if (UtilValidate.isEmpty(showPortletLink)) { - showPortletLink= new ShowPortletLink(showPortlet, this); - } - showPortletLink.addShowPorletTolink(showPortlet); - } - // #Eam# portletWidget + } public ModelMenuItem addUpdateMenuItem(ModelMenuItem modelMenuItem) { @@ -570,12 +559,6 @@ public class ModelMenuItem { return this.link; } - // #BAM# portletWidget - public ShowPortletLink getShowPortletLink() { - return this.showPortletLink; - } - // #EAM# portletWidget - public boolean isSelected(Map<String, Object> context) { return this.name.equals(modelMenu.getSelectedMenuItemContextFieldName(context)); } @@ -842,7 +825,6 @@ public class ModelMenuItem { protected FlexibleStringExpander widthExdr; protected FlexibleStringExpander heightExdr; protected FlexibleStringExpander borderExdr; - protected FlexibleStringExpander title; // #Eam# portletWidget protected String urlMode; public Image(Element imageElement) { @@ -852,7 +834,6 @@ public class ModelMenuItem { setStyle(imageElement.getAttribute("style")); setWidth(imageElement.getAttribute("width")); setHeight(imageElement.getAttribute("height")); - setTitle(imageElement.getAttribute("title"));// #Eam# portletWidget setBorder(UtilFormatOut.checkEmpty(imageElement.getAttribute("border"), "0")); setUrlMode(UtilFormatOut.checkEmpty(imageElement.getAttribute("url-mode"), "content")); @@ -886,12 +867,6 @@ public class ModelMenuItem { return this.borderExdr.expandString(context); } - // #Bam# portletWidget - public String getTitle(Map<String, Object> context) { - return this.title.expandString(context); - } - // #Eam# portletWidget - public String getUrlMode() { return this.urlMode; } @@ -928,313 +903,5 @@ public class ModelMenuItem { this.urlMode = val; } - // #Bam# portletWidget - public void setTitle(String val) { - String titleAttr = UtilFormatOut.checkNull(val); - this.title = FlexibleStringExpander.getInstance(titleAttr); - } - // #Eam# portletWidget - } - - public static class ShowPortletLink implements ModelWidget.ShowPortletLink { - protected ModelMenuItem linkMenuItem; - protected FlexibleStringExpander description; - protected FlexibleStringExpander imageTitle; - protected FlexibleStringExpander alternate; - protected FlexibleStringExpander image; - protected String size; - protected List<ShowPortletItem> showPortletItems = FastList.newInstance(); - public String listToString(List<String> list) { - String result = ""; - for(String s : list) { - result = result.concat(s).concat(";"); - } - if (result.endsWith(";")) { - return result.substring(0, result.length()-1); - } - return result; - } - - public ShowPortletLink(Element linkElement, ModelMenuItem parentMenuItem) { - this.linkMenuItem = parentMenuItem; - } - - public void renderFieldString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { - menuStringRenderer.renderShowPortletLink(writer, context, this); - } - - public void addShowPorletTolink(Element element) { - showPortletItems.add(new ShowPortletItem(element, this)); - } - - /** - * @param string - */ - public void setDescription(String string) { - if (UtilValidate.isNotEmpty(string)) { - this.description = FlexibleStringExpander.getInstance(string); - } - } - - /** - * @param string - */ - public void setImageTitle(String string) { - if (UtilValidate.isNotEmpty(string)) { - this.imageTitle = FlexibleStringExpander.getInstance(string); - } - } - public ModelMenuItem getModelMenuItem() { - return linkMenuItem; - } - public List<ShowPortletItem> getShowPortletItems() { - return showPortletItems; - } - /** - * @param string - */ - public void setAlternate(String string) { - if (UtilValidate.isNotEmpty(string)) { - this.alternate = FlexibleStringExpander.getInstance(string); - } - } - - public String getDescription(Map<String, Object> context) { - String description = ""; - if (UtilValidate.isNotEmpty(this.description)) { - description = this.description.expandString(context); - } - if (UtilValidate.isEmpty(description)) { - description = this.getModelMenuItem().getTitle(context); - } - return description; - } - - public String getAlternate(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(alternate)) { - return this.alternate.expandString(context); - } - return ""; - } - - public String getImageTitle(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(imageTitle)) { - return this.imageTitle.expandString(context); - } - return ""; - } - - public String getImage(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(imageTitle)) { - return this.image.expandString(context); - } - return ""; - } - - public String getSize() { - return this.size; - } - - public String setSize(String size) { - return this.size = size; - } - } - - public static class ShowPortletItem implements ModelWidget.ShowPortletItem { - - protected FlexibleStringExpander areaId; - protected FlexibleStringExpander target; - protected ShowPortletLink showPortletLink; - protected FlexibleStringExpander portletId; - protected boolean requireConfirmation; - protected FlexibleStringExpander confirmationMessage; - protected FlexibleStringExpander portalPageId; - protected FlexibleStringExpander portletSeqId; - protected List<WidgetWorker.Parameter> parameterList = FastList.newInstance(); - - public ShowPortletItem(Element element, ShowPortletLink showPortletLink) { - this.showPortletLink = showPortletLink; - this.setConfirmationMessage(element.getAttribute("confirmation-message")); - this.setRequireConfirmation(("true".equals(element.getAttribute("request-confirmation")))); - this.setAreaId(element.getAttribute("area-id")); - this.setPortletId(element.getAttribute("portlet-id")); - this.setPortalPageId(element.getAttribute("portal-page-id")); - this.setPortletSeqId(element.getAttribute("portlet-seq-id")); - this.setDescription(element.getAttribute("description")); - this.setAlternate(element.getAttribute("alternate")); - this.setImageTitle(element.getAttribute("image-title")); - this.setTarget(element.getAttribute("target")); - this.setImage (element.getAttribute("image-location")); - this.setSize(element.getAttribute("size")); - - List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter"); - for (Element parameterElement: parameterElementList) { - this.parameterList.add(new WidgetWorker.Parameter(parameterElement)); - } - - } - public ModelMenuItem getModelMenuItem() { - return showPortletLink.getModelMenuItem(); - } - - public String getDescription(Map<String, Object> context) { - return showPortletLink.getDescription(context); - } - - public String getPortalPageId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portalPageId)) { - return this.portalPageId.expandString(context); - } - return ""; - } - - public String getPortletId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portletId)) { - return this.portletId.expandString(context); - } - return ""; - } - - public String getPortletSeqId(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(portletSeqId)) { - return this.portletSeqId.expandString(context); - } - return ""; - } - - public String getAreaId(Map<String, Object> context) { - String areaIdValue = ""; - if (UtilValidate.isNotEmpty(areaId)) { - areaIdValue = this.areaId.expandString(context); - } - return areaIdValue; - } - - public String getAlternate(Map<String, Object> context) { - return showPortletLink.getAlternate(context); - } - - public String getImageTitle(Map<String, Object> context) { - return showPortletLink.getImageTitle(context); - } - - public String getTarget(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(target)) { - return this.target.expandString(context); - } - return ""; - } - - public Map<String, String> getParameterMap(Map<String, Object> context) { - Map<String, String> fullParameterMap = FastMap.newInstance(); - - for (WidgetWorker.Parameter parameter: this.parameterList) { - String paramValue = parameter.getValue(context); - if (UtilValidate.isNotEmpty(paramValue) || parameter.sendIfEmpty(context)){ - if ("idDescription".equals(parameter.getName())) { - if (UtilValidate.isNotEmpty(paramValue)) { - paramValue = UtilURL.removeBadCharForUrl(paramValue); - fullParameterMap.put(parameter.getName(), paramValue); - } - } - else { - fullParameterMap.put(parameter.getName(), paramValue); - } - } - } - return fullParameterMap; - } - - public String getImage(Map<String, Object> context) { - if (UtilValidate.isNotEmpty(this.showPortletLink.image)) { - return this.showPortletLink.image.expandString(context); - } - return ""; - } - public String getSize() { - return showPortletLink.size; - } - - public void setImage(String image) { - this.showPortletLink.image = FlexibleStringExpander.getInstance(image); - } - public void setSize(String size) { - showPortletLink.setSize(size); - } - - /** - * @param string - */ - public void setAreaId(String areaId) { - this.areaId = FlexibleStringExpander.getInstance(areaId); - } - - /** - * @param string - */ - public void setPortletId(String portletId) { - this.portletId = FlexibleStringExpander.getInstance(portletId); - } - - /** - * @param string - */ - public void setPortletSeqId(String portletSeqId) { - this.portletSeqId = FlexibleStringExpander.getInstance(portletSeqId); - } - - /** - * @param string - */ - public void setPortalPageId(String portalPageId) { - this.portalPageId = FlexibleStringExpander.getInstance(portalPageId); - } - /** - * @param string - */ - public void setDescription(String string) { - showPortletLink.setDescription(string); - } - - /** - * @param string - */ - public void setImageTitle(String string) { - showPortletLink.setImageTitle(string); - } - - /** - * @param string - */ - public void setAlternate(String string) { - showPortletLink.setAlternate(string); - } - - /** - * @param string - */ - public void setTarget(String string) { - this.target = FlexibleStringExpander.getInstance(string); - } - - public String getConfirmationMessage(Map<String, Object> context) { - String areaIdValue = ""; - if (UtilValidate.isNotEmpty(confirmationMessage)) { - areaIdValue = this.confirmationMessage.expandString(context); - } - return areaIdValue; - } - - public void setRequireConfirmation(boolean reqConfirm) { - requireConfirmation = reqConfirm; - } - - public boolean getRequireConfirmation() { - return requireConfirmation; - } - - public void setConfirmationMessage(String string) { - this.confirmationMessage = FlexibleStringExpander.getInstance(string); - } } } |
| Free forum by Nabble | Edit this page |
