You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2009/03/27 17:59:31 UTC
svn commit: r759246 [1/4] - in
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget: ./ cache/ fo/ form/
html/ menu/ screen/ text/ tree/ xml/
Author: doogie
Date: Fri Mar 27 16:59:28 2009
New Revision: 759246
URL: http://svn.apache.org/viewvc?rev=759246&view=rev
Log:
Fix lines that *only* have whitespace.
Modified:
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/GenericWidgetOutput.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRendererImage.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenXmlViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java Fri Mar 27 16:59:28 2009
@@ -31,7 +31,7 @@
public interface DataResourceWorkerInterface {
public String renderDataResourceAsTextExt(GenericDelegator delegator, String dataResourceId, Map templateContext,
Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException;
-
+
public void renderDataResourceAsTextExt(GenericDelegator delegator, String dataResourceId, Appendable out, Map templateContext,
Locale locale, String targetMimeTypeId, boolean cache) throws GeneralException, IOException;
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Fri Mar 27 16:59:28 2009
@@ -53,7 +53,7 @@
public static final String enableBoundaryCommentsParam = "widgetVerbose";
protected String name;
protected boolean enableWidgetBoundaryComments = false;
-
+
protected ModelWidget() {}
/**
@@ -71,7 +71,7 @@
public String getName() {
return name;
}
-
+
/**
* Returns the widget's name to be used in boundary comments. The default action
* is to return the widget's name. Derived classes can override this method to
@@ -81,7 +81,7 @@
public String getBoundaryCommentName() {
return name;
}
-
+
/**
* Returns true if boundary comments are enabled for this widget, otherwise
* returns false.
@@ -127,7 +127,7 @@
}
return paginator_number;
}
-
+
public void incrementPaginatorNumber(Map<String, Object> context) {
Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
if (globalCtx != null) {
@@ -140,5 +140,5 @@
}
}
}
-
+
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Fri Mar 27 16:59:28 2009
@@ -51,7 +51,7 @@
String prefix, boolean fullPath, boolean secure, boolean encode, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException {
String localRequestName = UtilHttp.encodeAmpersands(target);
Appendable localWriter = new StringWriter();
-
+
if ("intra-app".equals(targetType)) {
if (request != null && response != null) {
ServletContext servletContext = (ServletContext) request.getSession().getServletContext();
@@ -83,7 +83,7 @@
} else {
localWriter.append(localRequestName);
}
-
+
if (parameterList != null && parameterList.size() > 0) {
String localUrl = localWriter.toString();
externalWriter.append(localUrl);
@@ -92,7 +92,7 @@
externalWriter.append('?');
needsAmp = false;
}
-
+
for (WidgetWorker.Parameter parameter: parameterList) {
if (needsAmp) {
externalWriter.append("&");
@@ -143,9 +143,9 @@
} else {
WidgetWorker.makeHyperlinkString(writer, linkStyle, targetType, target, parameterList, description, modelFormField, request, response, context, targetWindow);
}
-
+
}
-
+
public static void makeHyperlinkString(Appendable writer, String linkStyle, String targetType, String target, List<WidgetWorker.Parameter> parameterList,
String description, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context, String targetWindow)
throws IOException {
@@ -163,7 +163,7 @@
buildHyperlinkUrl(writer, target, targetType, parameterList, null, false, false, true, request, response, context);
writer.append("\"");
-
+
if (UtilValidate.isNotEmpty(targetWindow)) {
writer.append(" target=\"");
writer.append(targetWindow);
@@ -179,7 +179,7 @@
}
writer.append('>');
-
+
if (UtilValidate.isNotEmpty(request.getAttribute("image"))){
writer.append("<img src=\"");
writer.append(request.getAttribute("image").toString());
@@ -190,7 +190,7 @@
writer.append("</a>");
}
}
-
+
public static void makeHiddenFormLinkAnchor(Appendable writer, String linkStyle, String description, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException {
if (UtilValidate.isNotEmpty(description) || UtilValidate.isNotEmpty(request.getAttribute("image"))) {
writer.append("<a");
@@ -204,7 +204,7 @@
writer.append(" href=\"javascript:document.");
writer.append(makeLinkHiddenFormName(context, modelFormField));
writer.append(".submit()\"");
-
+
if (UtilValidate.isNotEmpty(modelFormField.getEvent()) && UtilValidate.isNotEmpty(modelFormField.getAction(context))) {
writer.append(" ");
writer.append(modelFormField.getEvent());
@@ -214,7 +214,7 @@
}
writer.append('>');
-
+
if (UtilValidate.isNotEmpty(request.getAttribute("image"))){
writer.append("<img src=\"");
writer.append(request.getAttribute("image").toString());
@@ -225,7 +225,7 @@
writer.append("</a>");
}
}
-
+
public static void makeHiddenFormLinkForm(Appendable writer, String target, String targetType, String targetWindow, List<WidgetWorker.Parameter> parameterList, ModelFormField modelFormField, HttpServletRequest request, HttpServletResponse response, Map<String, Object> context) throws IOException {
writer.append("<form method=\"post\"");
writer.append(" action=\"");
@@ -252,10 +252,10 @@
writer.append(parameter.getValue(context));
writer.append("\" type=\"hidden\"/>");
}
-
+
writer.append("</form>");
}
-
+
public static String makeLinkHiddenFormName(Map<String, Object> context, ModelFormField modelFormField) {
ModelForm modelForm = modelFormField.getModelForm();
Integer itemIndex = (Integer) context.get("itemIndex");
@@ -303,7 +303,7 @@
}
}
}
-
+
public static String determineAutoLinkType(String linkType, String target, String targetType, HttpServletRequest request) {
if ("auto".equals(linkType)) {
if ("intra-app".equals(targetType)) {
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/GenericWidgetOutput.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/GenericWidgetOutput.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/GenericWidgetOutput.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/GenericWidgetOutput.java Fri Mar 27 16:59:28 2009
@@ -27,7 +27,7 @@
public GenericWidgetOutput(String output) {
this.output = new String(output);
}
-
+
public String toString() {
return this.output;
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java Fri Mar 27 16:59:28 2009
@@ -32,9 +32,9 @@
public class WidgetContextCacheKey {
public static final String module = WidgetContextCacheKey.class.getName();
-
+
private static Set<String> fieldNamesToSkip;
-
+
static {
fieldNamesToSkip = FastSet.newInstance();
fieldNamesToSkip.add("globalContext");
@@ -78,7 +78,7 @@
fieldNamesToSkip.add("visit");
fieldNamesToSkip.add("visitor");
}
-
+
protected Map<String, Object> context;
public WidgetContextCacheKey(Map<String, Object> context) {
@@ -133,7 +133,7 @@
}
return true;
}
-
+
public String toString() {
Map<String, Object> printableMap = FastMap.newInstance();
Iterator fieldNameIt = this.context.keySet().iterator();
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java Fri Mar 27 16:59:28 2009
@@ -59,7 +59,7 @@
public class FoFormRenderer extends HtmlWidgetRenderer implements FormStringRenderer {
public static final String module = FoFormRenderer.class.getName();
-
+
HttpServletRequest request;
HttpServletResponse response;
@@ -408,12 +408,12 @@
public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
// TODO
}
-
+
public void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner) throws IOException {
// TODO
this.makeBlockString(writer, null, "");
}
-
+
public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
}
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java Fri Mar 27 16:59:28 2009
@@ -45,11 +45,11 @@
* Widget Library - Form factory class
*/
public class FormFactory {
-
+
public static final String module = FormFactory.class.getName();
public static final UtilCache<String, ModelForm> formLocationCache = new UtilCache<String, ModelForm>("widget.form.locationResource", 0, 0, false);
public static final UtilCache<String, ModelForm> formWebappCache = new UtilCache<String, ModelForm>("widget.form.webappResource", 0, 0, false);
-
+
public static Map<String, ModelForm> getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext)
throws IOException, SAXException, ParserConfigurationException {
/*
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java Fri Mar 27 16:59:28 2009
@@ -45,11 +45,11 @@
public void renderFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
public void renderSingleFormFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException;
-
+
public void renderFormOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderMultiFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
-
+
public void renderFormatListWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormatListWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
@@ -61,7 +61,7 @@
public void renderFormatHeaderRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormatHeaderRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormatHeaderRowFormCellTitleSeparator(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) throws IOException;
-
+
public void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormatItemRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException;
public void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) throws IOException;
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Fri Mar 27 16:59:28 2009
@@ -155,17 +155,17 @@
* Can also include Banner objects.
*/
protected List<FieldGroupBase> fieldGroupList = FastList.newInstance();
-
+
/** This Map is keyed with the field name and has a FieldGroup for the value.
* Can also include Banner objects.
*/
protected Map<String, FieldGroupBase> fieldGroupMap = FastMap.newInstance();
-
+
/** This field group will be the "catch-all" group for fields that are not
* included in an explicit field-group.
*/
protected FieldGroup defaultFieldGroup;
-
+
/** Default hyperlink target. */
public static String DEFAULT_TARGET_TYPE = "intra-app";
@@ -179,18 +179,18 @@
public static String DEFAULT_PAG_PREV_STYLE = "nav-previous";
public static String DEFAULT_PAG_NEXT_STYLE = "nav-next";
public static String DEFAULT_PAG_LAST_STYLE = "nav-last";
-
+
/** Sort field default styles. */
public static String DEFAULT_SORT_FIELD_STYLE = "sort-order";
public static String DEFAULT_SORT_FIELD_ASC_STYLE = "sort-order-asc";
public static String DEFAULT_SORT_FIELD_DESC_STYLE = "sort-order-desc";
-
+
protected List<ModelFormAction> actions;
protected List<ModelFormAction> rowActions;
protected FlexibleStringExpander rowCountExdr;
protected List<ModelFormField> multiSubmitFields = FastList.newInstance();
protected int rowCount = 0;
-
+
/** On Submit areas to be updated. */
protected List<UpdateArea> onSubmitUpdateAreas;
/** On Paginate areas to be updated. */
@@ -207,12 +207,12 @@
this.dispatchContext = dispatchContext;
initForm(formElement);
}
-
+
public ModelForm(Element formElement) {
super(formElement);
initForm(formElement);
}
-
+
public void initForm(Element formElement) {
setDefaultViewSize(UtilProperties.getPropertyValue("widget.properties", "widget.form.defaultViewSize"));
@@ -293,7 +293,7 @@
this.onSubmitUpdateAreas = parent.onSubmitUpdateAreas;
this.onPaginateUpdateAreas = parent.onPaginateUpdateAreas;
this.altRowStyles = parent.altRowStyles;
-
+
//these are done below in a special way...
//this.fieldList = parent.fieldList;
//this.fieldMap = parent.fieldMap;
@@ -438,7 +438,7 @@
if (this.paginateStyle == null || formElement.hasAttribute("paginate-style")) {
setPaginateStyle(formElement.getAttribute("paginate-style"));
}
-
+
this.paginate = "true".equals(formElement.getAttribute("paginate"));
this.skipStart = "true".equals(formElement.getAttribute("skip-start"));
this.skipEnd = "true".equals(formElement.getAttribute("skip-end"));
@@ -466,7 +466,7 @@
AltRowStyle altRowStyle = new AltRowStyle(altRowStyleElement);
this.altRowStyles.add(altRowStyle);
}
-
+
// alt-target
List altTargetElements = UtilXml.childElementList(formElement, "alt-target");
Iterator altTargetElementIter = altTargetElements.iterator();
@@ -475,14 +475,14 @@
AltTarget altTarget = new AltTarget(altTargetElement);
this.addAltTarget(altTarget);
}
-
+
// on-event-update-area
List<? extends Element> updateAreaElements = UtilXml.childElementList(formElement, "on-event-update-area");
for (Element updateAreaElement : updateAreaElements) {
UpdateArea updateArea = new UpdateArea(updateAreaElement);
this.addOnEventUpdateArea(updateArea);
}
-
+
// auto-fields-service
List autoFieldsServiceElements = UtilXml.childElementList(formElement, "auto-fields-service");
Iterator autoFieldsServiceElementIter = autoFieldsServiceElements.iterator();
@@ -537,13 +537,13 @@
} else if (tagName.equals("banner")) {
Banner thisBanner = new Banner(sortFieldElement, this);
this.fieldGroupList.add(thisBanner);
-
+
lastFieldGroup = new FieldGroup(null, this);
this.fieldGroupList.add(lastFieldGroup);
} else if (tagName.equals("field-group")) {
FieldGroup thisFieldGroup = new FieldGroup(sortFieldElement, this);
this.fieldGroupList.add(thisFieldGroup);
-
+
lastFieldGroup = new FieldGroup(null, this);
this.fieldGroupList.add(lastFieldGroup);
}
@@ -796,7 +796,7 @@
*/
public void renderFormString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
runFormActions(context);
-
+
setWidgetBoundaryComments(context);
// if this is a list form, don't useRequestParameters
@@ -844,7 +844,7 @@
public void renderSingleFormString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer, int positions) throws IOException {
List<ModelFormField> tempFieldList = FastList.newInstance();
tempFieldList.addAll(this.fieldList);
-
+
// Check to see if there is a field, same name and same use-when (could come from extended form)
for (int j = 0; j < tempFieldList.size(); j++) {
ModelFormField modelFormField = (ModelFormField) tempFieldList.get(j);
@@ -888,7 +888,7 @@
if (fieldIter.hasNext()) {
nextFormField = (ModelFormField) fieldIter.next();
}
-
+
FieldGroup currentFieldGroup = null;
String currentFieldGroupName = null;
String lastFieldGroupName = null;
@@ -901,8 +901,8 @@
currentFieldGroupName = currentFieldGroup.getId();
}
}
-
-
+
+
boolean isFirstPass = true;
boolean haveRenderedOpenFieldRow = false;
while (currentFormField != null) {
@@ -948,12 +948,12 @@
currentFieldGroup = defaultFieldGroup;
}
currentFieldGroupName = currentFieldGroup.getId();
-
+
if (lastFieldGroup != null ) {
lastFieldGroupName = lastFieldGroup.getId();
if (!lastFieldGroupName.equals(currentFieldGroupName)) {
lastFieldGroup.renderEndString(writer, context, formStringRenderer);
-
+
List inbetweenList = getInbetweenList(lastFieldGroup, currentFieldGroup);
Iterator iter = inbetweenList.iterator();
while (iter.hasNext()) {
@@ -964,7 +964,7 @@
}
}
}
-
+
if (currentFieldGroup != null && (lastFieldGroup == null || !lastFieldGroupName.equals(currentFieldGroupName))) {
currentFieldGroup.renderStartString(writer, context, formStringRenderer);
lastFieldGroup = currentFieldGroup;
@@ -1106,7 +1106,7 @@
this.renderItemRows(writer, context, formStringRenderer, false, numOfColumns);
formStringRenderer.renderFormatListWrapperClose(writer, context, this);
-
+
if (!skipEnd) {
formStringRenderer.renderMultiFormClose(writer, context, this);
}
@@ -1218,7 +1218,7 @@
if (maxNumOfColumns < numOfColumns) {
maxNumOfColumns = numOfColumns;
}
-
+
fieldRowsByPosition.add(UtilMisc.toMap("displayBefore", innerDisplayHyperlinkFieldsBegin,
"inputFields", innerFormFields,
"displayAfter", innerDisplayHyperlinkFieldsEnd));
@@ -1232,7 +1232,7 @@
List innerDisplayHyperlinkFieldsBegin = (List)listsMap.get("displayBefore");
List innerFormFields = (List)listsMap.get("inputFields");
List innerDisplayHyperlinkFieldsEnd = (List)listsMap.get("displayAfter");
-
+
int numOfCells = innerDisplayHyperlinkFieldsBegin.size() +
innerDisplayHyperlinkFieldsEnd.size() +
(innerFormFields.size() > 0? 1: 0);
@@ -1310,7 +1310,7 @@
}
public void preparePager(Map<String, Object> context) {
-
+
// increment the paginator
this.incrementPaginatorNumber(context);
this.rowCount = 0;
@@ -1434,7 +1434,7 @@
if (itemIndex < lowIndex) {
continue;
}
-
+
Map<String, Object> itemMap = UtilGenerics.checkMap(item);
MapStack<String> localContext = MapStack.create(context);
if (UtilValidate.isNotEmpty(this.getListEntryName())) {
@@ -1587,7 +1587,7 @@
context.put("highIndex", Integer.valueOf(isOverridenListSize() ? listSize : highIndex));
}
context.put("actualPageSize", Integer.valueOf(highIndex - lowIndex));
-
+
if (iter instanceof EntityListIterator) {
try {
((EntityListIterator) iter).close();
@@ -1783,7 +1783,7 @@
public String getTargetType() {
return this.targetType;
}
-
+
public String getParentFormName() {
return this.parentFormName;
}
@@ -1806,19 +1806,19 @@
public Map<String, ? extends Object> getDefaultMap(Map<String, ? extends Object> context) {
return this.defaultMapName.get(context);
}
-
+
public String getDefaultRequiredFieldStyle() {
return this.defaultRequiredFieldStyle;
}
-
+
public String getDefaultSortFieldStyle() {
return (UtilValidate.isEmpty(this.defaultSortFieldStyle) ? DEFAULT_SORT_FIELD_STYLE : this.defaultSortFieldStyle);
}
-
+
public String getDefaultSortFieldAscStyle() {
return (UtilValidate.isEmpty(this.defaultSortFieldAscStyle) ? DEFAULT_SORT_FIELD_ASC_STYLE : this.defaultSortFieldAscStyle);
}
-
+
public String getDefaultSortFieldDescStyle() {
return (UtilValidate.isEmpty(this.defaultSortFieldDescStyle) ? DEFAULT_SORT_FIELD_DESC_STYLE : this.defaultSortFieldDescStyle);
}
@@ -1847,7 +1847,7 @@
public String getOddRowStyle() {
return this.oddRowStyle;
}
-
+
public String getEvenRowStyle() {
return this.evenRowStyle;
}
@@ -1855,11 +1855,11 @@
public String getDefaultTableStyle() {
return this.defaultTableStyle;
}
-
+
public String getHeaderRowStyle() {
return this.headerRowStyle;
}
-
+
public String getDefaultTitleStyle() {
return this.defaultTitleStyle;
}
@@ -1919,7 +1919,7 @@
if (simpleEncoder != null) {
expanderContext = StringUtil.HtmlEncodingMapWrapper.getHtmlEncodingMapWrapper(context, simpleEncoder);
}
-
+
try {
// use the same Interpreter (ie with the same context setup) for all evals
Interpreter bsh = this.getBshInterpreter(context);
@@ -1982,11 +1982,11 @@
public String getBoundaryCommentName() {
return formLocation + "#" + name;
}
-
+
public void resetBshInterpreter(Map<String, Object> context) {
context.remove("bshInterpreter");
}
-
+
public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError {
Interpreter bsh = (Interpreter) context.get("bshInterpreter");
if (bsh == null) {
@@ -2044,35 +2044,35 @@
public void setDefaultWidgetAreaStyle(String string) {
this.defaultWidgetAreaStyle = string;
}
-
+
/**
* @param string
*/
public void setOddRowStyle(String string) {
this.oddRowStyle = string;
}
-
+
/**
* @param string
*/
public void setEvenRowStyle(String string) {
this.evenRowStyle = string;
}
-
+
/**
* @param string
*/
public void setDefaultTableStyle(String string) {
this.defaultTableStyle = string;
}
-
+
/**
* @param string
*/
public void setHeaderRowStyle(String string) {
this.headerRowStyle = string;
}
-
+
/**
* @param string
*/
@@ -2111,7 +2111,7 @@
public String getFormLocation() {
return this.formLocation;
}
-
+
/**
* @param string
*/
@@ -2193,7 +2193,7 @@
public String getPaginateTargetAnchor() {
return this.paginateTargetAnchor;
}
-
+
public String getPaginateIndexField(Map<String, Object> context) {
String field = this.paginateIndexField.expandString(context);
if (UtilValidate.isEmpty(field)) {
@@ -2206,7 +2206,7 @@
public int getPaginateIndex(Map<String, Object> context) {
String field = this.getPaginateIndexField(context);
-
+
int viewIndex = 0;
try {
Object value = context.get(field);
@@ -2216,7 +2216,7 @@
Map parameters = (Map) context.get("parameters");
if (parameters != null) {
value = parameters.get("VIEW_INDEX" + "_" + getPaginatorNumber(context));
-
+
if (value == null) {
value = parameters.get(field);
}
@@ -2231,7 +2231,7 @@
} catch (Exception e) {
Debug.logWarning(e, "Error getting paginate view index: " + e.toString(), module);
}
-
+
return viewIndex;
}
@@ -2335,7 +2335,7 @@
public String getTargetWindow(Map<String, Object> context) {
return this.targetWindowExdr.expandString(context);
}
-
+
public void setTargetWindow( String val ) {
this.targetWindowExdr = FlexibleStringExpander.getInstance(val);
}
@@ -2351,7 +2351,7 @@
public boolean getSkipStart() {
return this.skipStart;
}
-
+
public boolean getSkipEnd() {
return this.skipEnd;
}
@@ -2363,11 +2363,11 @@
public void setSkipStart(boolean val) {
this.skipStart = val;
}
-
+
public void setSkipEnd(boolean val) {
this.skipEnd = val;
}
-
+
public boolean getHideHeader() {
return this.hideHeader;
}
@@ -2412,7 +2412,7 @@
defaultViewSize = DEFAULT_PAGE_SIZE;
}
}
-
+
public int getListSize(Map<String, Object> context) {
Integer value = (Integer) context.get("listSize");
return value != null ? value.intValue() : 0;
@@ -2482,11 +2482,11 @@
List items = (List) entryList;
listSize = items.size();
}
-
+
if (paginate) {
viewIndex = this.getPaginateIndex(context);
viewSize = this.getPaginateSize(context);
-
+
lowIndex = viewIndex * viewSize;
highIndex = (viewIndex + 1) * viewSize;
} else {
@@ -2495,18 +2495,18 @@
lowIndex = 0;
highIndex = defaultViewSize;
}
-
+
context.put("listSize", Integer.valueOf(listSize));
context.put("viewIndex", Integer.valueOf(viewIndex));
context.put("viewSize", Integer.valueOf(viewSize));
context.put("lowIndex", Integer.valueOf(lowIndex));
context.put("highIndex", Integer.valueOf(highIndex));
}
-
+
public String getPassedRowCount(Map<String, Object> context) {
return rowCountExdr.expandString(context);
}
-
+
public int getRowCount() {
return this.rowCount;
}
@@ -2557,7 +2557,7 @@
}
return inbetweenList;
}
-
+
public String getSortField(Map<String, Object> context) {
String field = "sortField";
String value = null;
@@ -2573,16 +2573,16 @@
} catch (Exception e) {
Debug.logWarning(e, "Error getting sortField: " + e.toString(), module);
}
-
+
return value;
}
-
+
/* Returns the list of ModelForm.UpdateArea objects.
*/
public List<UpdateArea> getOnSubmitUpdateAreas() {
return this.onSubmitUpdateAreas;
}
-
+
public static class AltRowStyle {
public String useWhen;
public String style;
@@ -2591,7 +2591,7 @@
this.style = altRowStyleElement.getAttribute("style");
}
}
-
+
/**
* iterate through alt-row-styles list to see if should be used, then add style
* @return The style for item row
@@ -2622,7 +2622,7 @@
return styles;
}
-
+
public static class AltTarget {
public String useWhen;
public FlexibleStringExpander targetExdr;
@@ -2727,7 +2727,7 @@
this.defaultPosition = position;
}
}
-
+
public static interface FieldGroupBase {}
public static class FieldGroup implements FieldGroupBase {
@@ -2740,7 +2740,7 @@
protected static int baseSeqNo = 0;
protected static String baseId = "_G";
public FieldGroup(Element sortOrderElement, ModelForm modelForm) {
-
+
this.modelForm = modelForm;
if (sortOrderElement != null) {
this.id = sortOrderElement.getAttribute("id");
@@ -2755,7 +2755,7 @@
if (this.initiallyCollapsed) {
this.collapsible = true;
}
-
+
List sortFieldElements = UtilXml.childElementList(sortOrderElement, "sort-field");
Iterator sortFieldElementIter = sortFieldElements.iterator();
while (sortFieldElementIter.hasNext()) {
@@ -2768,19 +2768,19 @@
this.setId(lastGroupId);
}
}
-
+
public String getId() {
return this.id;
}
-
+
public void setId( String id) {
this.id = id;
}
-
+
public String getStyle() {
return this.style;
}
-
+
public String getTitle() {
return this.title;
}
@@ -2797,7 +2797,7 @@
formStringRenderer.renderFieldGroupOpen(writer, context, this);
formStringRenderer.renderFormatSingleWrapperOpen(writer, context, modelForm);
}
-
+
public void renderEndString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
formStringRenderer.renderFormatSingleWrapperClose(writer, context, modelForm);
formStringRenderer.renderFieldGroupClose(writer, context, this);
@@ -2813,7 +2813,7 @@
public FlexibleStringExpander leftTextStyle;
public FlexibleStringExpander rightText;
public FlexibleStringExpander rightTextStyle;
-
+
public Banner(Element sortOrderElement, ModelForm modelForm) {
this.modelForm = modelForm;
this.style = FlexibleStringExpander.getInstance(sortOrderElement.getAttribute("style"));
@@ -2824,7 +2824,7 @@
this.rightText = FlexibleStringExpander.getInstance(sortOrderElement.getAttribute("right-text"));
this.rightTextStyle = FlexibleStringExpander.getInstance(sortOrderElement.getAttribute("right-text-style"));
}
-
+
public String getStyle(Map<String, Object> context) { return this.style.expandString(context); }
public String getText(Map<String, Object> context) { return this.text.expandString(context); }
public String getTextStyle(Map<String, Object> context) { return this.textStyle.expandString(context); }
@@ -2832,7 +2832,7 @@
public String getLeftTextStyle(Map<String, Object> context) { return this.leftTextStyle.expandString(context); }
public String getRightText(Map<String, Object> context) { return this.rightText.expandString(context); }
public String getRightTextStyle(Map<String, Object> context) { return this.rightTextStyle.expandString(context); }
-
+
public void renderString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
formStringRenderer.renderBanner(writer, context, this);
}
@@ -2921,7 +2921,7 @@
String target = link.getTarget(null);
String urlMode = link.getTargetType();
// Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "] with target [" + target + "]", module);
-
+
Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
if (controllerLocAndRequestSet != null) {
allRequestsUsed.addAll(controllerLocAndRequestSet);
@@ -2979,14 +2979,14 @@
for (AltTarget altTarget: this.altTargets) {
String target = altTarget.targetExdr.getOriginal();
String urlMode = "intra-app";
-
+
Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode);
if (controllerLocAndRequestSet != null) {
allRequestsUsed.addAll(controllerLocAndRequestSet);
}
}
}
-
+
if (!this.target.isEmpty()) {
String target = this.target.getOriginal();
String urlMode = UtilValidate.isNotEmpty(this.targetType) ? this.targetType : "intra-app";
@@ -2997,7 +2997,7 @@
}
}
}
-
+
return allRequestsUsed;
}
}
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Fri Mar 27 16:59:28 2009
@@ -61,12 +61,12 @@
this.modelForm = modelForm;
if (Debug.verboseOn()) Debug.logVerbose("Reading Screen action with name: " + actionElement.getNodeName(), module);
}
-
+
public abstract void runAction(Map<String, Object> context);
-
+
public static List<ModelFormAction> readSubActions(ModelForm modelForm, Element parentElement) {
List<ModelFormAction> actions = new LinkedList<ModelFormAction>();
-
+
for (Element actionElement: UtilXml.childElementList(parentElement)) {
if ("set".equals(actionElement.getNodeName())) {
actions.add(new SetField(modelForm, actionElement));
@@ -88,19 +88,19 @@
throw new IllegalArgumentException("Action element not supported with name: " + actionElement.getNodeName());
}
}
-
+
return actions;
}
-
+
public static void runSubActions(List<ModelFormAction> actions, Map<String, Object> context) {
if (actions == null) return;
-
+
for (ModelFormAction action: actions) {
if (Debug.verboseOn()) Debug.logVerbose("Running screen action " + action.getClass().getName(), module);
action.runAction(context);
}
}
-
+
public static class SetField extends ModelFormAction {
protected FlexibleMapAccessor<Object> field;
protected FlexibleMapAccessor<String> fromField;
@@ -108,7 +108,7 @@
protected FlexibleStringExpander defaultExdr;
protected FlexibleStringExpander globalExdr;
protected String type;
-
+
public SetField(ModelForm modelForm, Element setElement) {
super (modelForm, setElement);
this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field"));
@@ -121,12 +121,12 @@
throw new IllegalArgumentException("Cannot specify a from-field [" + setElement.getAttribute("from-field") + "] and a value [" + setElement.getAttribute("value") + "] on the set action in a screen widget");
}
}
-
+
public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
boolean global = "true".equals(globalStr);
-
+
Object newValue = null;
if (!this.fromField.isEmpty()) {
newValue = this.fromField.get(context);
@@ -148,18 +148,18 @@
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
}
-
+
}
if (Debug.verboseOn()) Debug.logVerbose("In screen setting field [" + this.field.getOriginalName() + "] to value: " + newValue, module);
this.field.put(context, newValue);
-
+
if (global) {
Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext"));
if (globalCtx != null) {
this.field.put(globalCtx, newValue);
}
}
-
+
// this is a hack for backward compatibility with the JPublish page object
Map<String, Object> page = UtilGenerics.checkMap(context.get("page"));
if (page != null) {
@@ -167,19 +167,19 @@
}
}
}
-
+
public static class PropertyMap extends ModelFormAction {
protected FlexibleStringExpander resourceExdr;
protected FlexibleMapAccessor<Map<String, Object>> mapNameAcsr;
protected FlexibleStringExpander globalExdr;
-
+
public PropertyMap(ModelForm modelForm, Element setElement) {
super (modelForm, setElement);
this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource"));
this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name"));
this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
}
-
+
public void runAction(Map<String, Object> context) {
String globalStr = this.globalExdr.expandString(context);
// default to false
@@ -198,9 +198,9 @@
}
}
}
-
+
public static class PropertyToField extends ModelFormAction {
-
+
protected FlexibleStringExpander resourceExdr;
protected FlexibleStringExpander propertyExdr;
protected FlexibleMapAccessor<String> fieldAcsr;
@@ -219,7 +219,7 @@
this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name"));
this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global"));
}
-
+
public void runAction(Map<String, Object> context) {
//String globalStr = this.globalExdr.expandString(context);
// default to false
@@ -228,7 +228,7 @@
Locale locale = (Locale) context.get("locale");
String resource = this.resourceExdr.expandString(context, locale);
String property = this.propertyExdr.expandString(context, locale);
-
+
String value = null;
if (noLocale) {
value = UtilProperties.getPropertyValue(resource, property);
@@ -238,7 +238,7 @@
if (value == null || value.length() == 0) {
value = this.defaultExdr.expandString(context);
}
-
+
// note that expanding the value string here will handle defaultValue and the string from
// the properties file; if we decide later that we don't want the string from the properties
// file to be expanded we should just expand the defaultValue at the beginning of this method.
@@ -254,15 +254,15 @@
fieldAcsr.put(context, value);
}
}
-
+
public static class Script extends ModelFormAction {
protected String location;
-
+
public Script(ModelForm modelForm, Element scriptElement) {
super (modelForm, scriptElement);
this.location = scriptElement.getAttribute("location");
}
-
+
public void runAction(Map<String, Object> context) {
if (location.endsWith(".bsh")) {
try {
@@ -292,7 +292,7 @@
protected FlexibleStringExpander autoFieldMapExdr;
protected FlexibleStringExpander resultMapListNameExdr;
protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
-
+
public Service(ModelForm modelForm, Element serviceElement) {
super (modelForm, serviceElement);
this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name"));
@@ -315,19 +315,19 @@
this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list"));
if (this.resultMapListNameExdr.isEmpty()) this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name"));
}
-
+
this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement);
}
-
+
public void runAction(Map<String, Object> context) {
String serviceNameExpanded = this.serviceNameExdr.expandString(context);
if (UtilValidate.isEmpty(serviceNameExpanded)) {
throw new IllegalArgumentException("Service name was empty, expanded from: " + this.serviceNameExdr.getOriginal());
}
-
+
String autoFieldMapString = this.autoFieldMapExdr.expandString(context);
boolean autoFieldMapBool = !"false".equals(autoFieldMapString);
-
+
try {
Map<String, Object> serviceContext = null;
if (autoFieldMapBool) {
@@ -335,13 +335,13 @@
} else {
serviceContext = new HashMap<String, Object>();
}
-
+
if (this.fieldMap != null) {
EntityFinderUtil.expandFieldMapToContext(this.fieldMap, context, serviceContext);
}
-
+
Map<String, Object> result = this.modelForm.getDispatcher(context).runSync(serviceNameExpanded, serviceContext);
-
+
if (!this.resultMapNameAcsr.isEmpty()) {
this.resultMapNameAcsr.put(context, result);
String queryString = (String)result.get("queryString");
@@ -352,7 +352,7 @@
String queryStringEncoded = queryString.replaceAll("&", "%26");
context.put("queryStringEncoded", queryStringEncoded);
} catch (PatternSyntaxException e) {
-
+
}
}
} else {
@@ -377,12 +377,12 @@
public static class EntityOne extends ModelFormAction {
protected PrimaryKeyFinder finder;
-
+
public EntityOne(ModelForm modelForm, Element entityOneElement) {
super (modelForm, entityOneElement);
finder = new PrimaryKeyFinder(entityOneElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
finder.runFind(context, this.modelForm.getDelegator(context));
@@ -397,7 +397,7 @@
public static class EntityAnd extends ModelFormAction {
protected ByAndFinder finder;
String actualListName;
-
+
public EntityAnd(ModelForm modelForm, Element entityAndElement) {
super (modelForm, entityAndElement);
@@ -405,7 +405,7 @@
// Document ownerDoc = entityAndElement.getOwnerDocument();
// boolean useCache = "true".equalsIgnoreCase(entityAndElement.getAttribute("use-cache"));
// if (!useCache) UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc);
-
+
// make list-name optional
if (UtilValidate.isEmpty(entityAndElement.getAttribute("list")) && UtilValidate.isEmpty(entityAndElement.getAttribute("list-name"))) {
String lstNm = modelForm.getListName();
@@ -418,7 +418,7 @@
if (UtilValidate.isEmpty(this.actualListName)) this.actualListName = entityAndElement.getAttribute("list-name");
finder = new ByAndFinder(entityAndElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
// don't want to do this: context.put("defaultFormResultList", null);
@@ -434,21 +434,21 @@
throw new IllegalArgumentException(errMsg);
}
}
-
+
}
public static class EntityCondition extends ModelFormAction {
ByConditionFinder finder;
String actualListName;
-
+
public EntityCondition(ModelForm modelForm, Element entityConditionElement) {
super (modelForm, entityConditionElement);
-
+
//don't want to default to the iterator, should be specified explicitly, not the default
// Document ownerDoc = entityConditionElement.getOwnerDocument();
// boolean useCache = "true".equalsIgnoreCase(entityConditionElement.getAttribute("use-cache"));
// if (!useCache) UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc);
-
+
// make list-name optional
if (UtilValidate.isEmpty(entityConditionElement.getAttribute("list")) && UtilValidate.isEmpty(entityConditionElement.getAttribute("list-name"))) {
String lstNm = modelForm.getListName();
@@ -461,7 +461,7 @@
if (UtilValidate.isEmpty(this.actualListName)) this.actualListName = entityConditionElement.getAttribute("list-name");
finder = new ByConditionFinder(entityConditionElement);
}
-
+
public void runAction(Map<String, Object> context) {
try {
// don't want to do this: context.put("defaultFormResultList", null);
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=759246&r1=759245&r2=759246&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Fri Mar 27 16:59:28 2009
@@ -669,14 +669,14 @@
public String getEntry(Map<String, Object> context , String defaultValue) {
Boolean isError = (Boolean) context.get("isError");
Boolean useRequestParameters = (Boolean) context.get("useRequestParameters");
-
+
Locale locale = (Locale) context.get("locale");
if (locale == null) locale = Locale.getDefault();
TimeZone timeZone = (TimeZone) context.get("timeZone");
if (timeZone == null) timeZone = TimeZone.getDefault();
-
+
String returnValue;
-
+
// if useRequestParameters is TRUE then parameters will always be used, if FALSE then parameters will never be used
// if isError is TRUE and useRequestParameters is not FALSE (ie is null or TRUE) then parameters will be used
if ((Boolean.TRUE.equals(isError) && !Boolean.FALSE.equals(useRequestParameters)) || (Boolean.TRUE.equals(useRequestParameters))) {
@@ -722,7 +722,7 @@
// if no entry name was specified, use the field's name
retVal = dataMap.get(this.name);
}
-
+
// this is a special case to fill in fields during a create by default from parameters passed in
if (dataMapIsContext && retVal == null && !Boolean.FALSE.equals(useRequestParameters)) {
Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
@@ -760,7 +760,7 @@
returnValue = defaultValue;
}
}
-
+
if (this.getEncodeOutput() && returnValue != null) {
StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
if (simpleEncoder != null) {
@@ -994,7 +994,7 @@
// this should never happen, ie name is required
return "";
}
-
+
// search for a localized label for the field's name
Map<String, String> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap"));
if (uiLabelMap != null) {
@@ -1006,7 +1006,7 @@
} else {
Debug.logWarning("Could not find uiLabelMap in context while rendering form " + this.modelForm.getName(), module);
}
-
+
// create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
StringBuffer autoTitlewriter = new StringBuffer();
@@ -1049,21 +1049,21 @@
return this.modelForm.getDefaultRequiredFieldStyle();
}
}
-
+
public String getSortFieldStyle() {
if (UtilValidate.isNotEmpty(this.sortFieldStyle)) {
return this.sortFieldStyle;
}
return this.modelForm.getDefaultSortFieldStyle();
}
-
+
public String getSortFieldStyleAsc() {
if (UtilValidate.isNotEmpty(this.sortFieldAscStyle)) {
return this.sortFieldAscStyle;
}
return this.modelForm.getDefaultSortFieldAscStyle();
}
-
+
public String getSortFieldStyleDesc() {
if (UtilValidate.isNotEmpty(this.sortFieldDescStyle)) {
return this.sortFieldDescStyle;
@@ -1086,7 +1086,7 @@
return "";
}
}
-
+
public boolean getEncodeOutput() {
return this.encodeOutput;
}
@@ -1098,15 +1098,15 @@
return this.modelForm.getName() + "_" + this.getFieldName();
}
}
-
+
public String getHeaderLink() {
return headerLink;
}
-
+
public String getHeaderLinkStyle() {
return headerLinkStyle;
}
-
+
/**
* @param string
@@ -1306,7 +1306,7 @@
public void setUseWhen(String string) {
this.useWhen = FlexibleStringExpander.getInstance(string);
}
-
+
public void setEncodeOutput(boolean encodeOutput) {
this.encodeOutput = encodeOutput;
}
@@ -1317,7 +1317,7 @@
public void setWidgetAreaStyle(String string) {
this.widgetAreaStyle = string;
}
-
+
/**
* @param string
*/
@@ -1342,37 +1342,37 @@
public void setHeaderLink(String string) {
this.headerLink = string;
}
-
+
/**
* @param string
*/
public void setHeaderLinkStyle(String string) {
this.headerLinkStyle = string;
}
-
-
+
+
public boolean getRequiredField() {
return this.requiredField != null ? this.requiredField : false;
}
-
+
/**
* @param boolean
*/
public void setRequiredField(boolean required) {
this.requiredField = required;
}
-
+
public boolean isSortField() {
return this.sortField != null ? this.sortField.booleanValue() : false;
}
-
+
/**
* @param boolean
*/
public void setSortField(boolean sort) {
this.sortField = Boolean.valueOf(sort);
}
-
+
/**
* @param ModelForm
*/
@@ -1705,10 +1705,10 @@
}
findCondition = EntityCondition.makeCondition(expandedConditionList);
}
-
+
try {
Locale locale = UtilMisc.ensureLocale(context.get("locale"));
-
+
List<GenericValue> values = null;
values = delegator.findList(this.entityName, findCondition, null, this.orderByList, null, this.cache);
@@ -1730,7 +1730,7 @@
// expand with the new localContext, which is locale aware
String optionDesc = this.description.expandString(localContext, locale);
-
+
Object keyFieldObject = value.get(this.getKeyFieldName());
if (keyFieldObject == null) {
throw new IllegalArgumentException("The value found for key-name [" + this.getKeyFieldName() + "], may not be a valid key field name.");
@@ -1770,7 +1770,7 @@
protected String rows;
protected String cols;
protected Map<FlexibleMapAccessor<Object>, Object> fieldMap;
-
+
public InPlaceEditor (Element element) {
this.setUrl(element.getAttribute("url"));
this.cancelControl = element.getAttribute("cancel-control");
@@ -1794,11 +1794,11 @@
this.textAfterControls = element.getAttribute("text-after-controls");
this.textBetweenControls = element.getAttribute("text-between-controls");
this.updateAfterRequestCall = element.getAttribute("update-after-request-call");
-
+
Element simpleElement = UtilXml.firstChildElement(element, "simple-editor");
this.rows = simpleElement.getAttribute("rows");
this.cols = simpleElement.getAttribute("cols");
-
+
this.fieldMap = EntityFinderUtil.makeFieldMap(element);
}
@@ -2008,7 +2008,7 @@
this.fieldMap = fieldMap;
}
}
-
+
public static class DisplayField extends FieldInfo {
protected boolean alsoHidden = true;
protected FlexibleStringExpander description;
@@ -2036,7 +2036,7 @@
this.setDescription(element.getAttribute("description"));
this.setDate(element.getAttribute("date"));
this.alsoHidden = !"false".equals(element.getAttribute("also-hidden"));
-
+
Element inPlaceEditorElement = UtilXml.firstChildElement(element, "in-place-editor");
if (inPlaceEditorElement != null) {
this.inPlaceEditor = new InPlaceEditor(inPlaceEditorElement);
@@ -2081,7 +2081,7 @@
}
return retVal;
}
-
+
public InPlaceEditor getInPlaceEditor() {
return this.inPlaceEditor;
}
@@ -2099,7 +2099,7 @@
public void setDescription(String string) {
description = FlexibleStringExpander.getInstance(string);
}
-
+
/**
* @param string
*/
@@ -2112,7 +2112,7 @@
public void setDate(String string) {
date = FlexibleStringExpander.getInstance(string);
}
-
+
public void setInPlaceEditor(InPlaceEditor newInPlaceEditor) {
this.inPlaceEditor = newInPlaceEditor;
}
@@ -2157,7 +2157,7 @@
public String getDescription(Map<String, Object> context) {
Locale locale = UtilMisc.ensureLocale(context.get("locale"));
-
+
// rather than using the context to expand the string, lookup the given entity and use it to expand the string
GenericValue value = null;
String fieldKey = this.keyFieldName;
@@ -2173,7 +2173,7 @@
Debug.logError(e, errMsg, module);
throw new IllegalArgumentException(errMsg);
}
-
+
String retVal = null;
if (value != null) {
// expanding ${} stuff, passing locale explicitly to expand value string because it won't be found in the Entity
@@ -2200,7 +2200,7 @@
this.subHyperlink = newSubHyperlink;
}
}
-
+
public static class HyperlinkField extends FieldInfo {
public static String DEFAULT_TARGET_TYPE = "intra-app";
@@ -2235,7 +2235,7 @@
this.targetType = element.getAttribute("target-type");
this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window"));
this.image = element.getAttribute("image-location");
-
+
List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter");
for (Element parameterElement: parameterElementList) {
this.parameterList.add(new WidgetWorker.Parameter(parameterElement));
@@ -2253,7 +2253,7 @@
public String getLinkType() {
return this.linkType;
}
-
+
public String getTargetType() {
if (UtilValidate.isNotEmpty(this.targetType)) {
return this.targetType;
@@ -2266,7 +2266,7 @@
String targetWindow = this.targetWindowExdr.expandString(context);
return targetWindow;
}
-
+
public String getDescription(Map<String, Object> context) {
return this.description.expandString(context);
}
@@ -2274,11 +2274,11 @@
public String getTarget(Map<String, Object> context) {
return this.target.expandString(context);
}
-
+
public List<WidgetWorker.Parameter> getParameterList() {
return this.parameterList;
}
-
+
public String getImage() {
return this.image;
}
@@ -2331,12 +2331,12 @@
this.linkStyle = element.getAttribute("link-style");
this.targetType = element.getAttribute("target-type");
this.targetWindowExdr = FlexibleStringExpander.getInstance(element.getAttribute("target-window"));
-
+
List<? extends Element> parameterElementList = UtilXml.childElementList(element, "parameter");
for (Element parameterElement: parameterElementList) {
this.parameterList.add(new WidgetWorker.Parameter(parameterElement));
}
-
+
this.modelFormField = modelFormField;
}
@@ -2364,7 +2364,7 @@
String targetWindow = this.targetWindowExdr.expandString(context);
return targetWindow;
}
-
+
public String getTarget(Map<String, Object> context) {
if (this.target != null) {
return this.target.expandString(context);
@@ -2372,11 +2372,11 @@
return "";
}
}
-
+
public String getLinkType() {
return this.linkType;
}
-
+
public List<WidgetWorker.Parameter> getParameterList() {
return this.parameterList;
}
@@ -2388,7 +2388,7 @@
return "";
}
}
-
+
public ModelFormField getModelFormField() {
return this.modelFormField;
}
@@ -2458,7 +2458,7 @@
this.useWhen = FlexibleStringExpander.getInstance(string);
}
}
-
+
public static class AutoComplete {
protected String autoSelect;
protected String frequency;
@@ -2468,7 +2468,7 @@
protected String partialChars;
protected String ignoreCase;
protected String fullSearch;
-
+
public AutoComplete(Element element) {
this.autoSelect = element.getAttribute("auto-select");
this.frequency = element.getAttribute("frequency");
@@ -2479,67 +2479,67 @@
this.ignoreCase = element.getAttribute("ignore-case");
this.fullSearch = element.getAttribute("full-search");
}
-
+
public String getAutoSelect() {
return this.autoSelect;
}
-
+
public String getFrequency() {
return this.frequency;
}
-
+
public String getMinChars() {
return this.minChars;
}
-
+
public String getChoices() {
return this.choices;
}
-
+
public String getPartialSearch() {
return this.partialSearch;
}
-
+
public String getPartialChars() {
return this.partialChars;
}
-
+
public String getIgnoreCase() {
return this.ignoreCase;
}
-
+
public String getFullSearch() {
return this.fullSearch;
}
-
+
public void setAutoSelect(String string) {
this.autoSelect = string;
}
-
+
public void setFrequency(String string) {
this.frequency = string;
}
-
+
public void setMinChars(String string) {
this.minChars = string;
}
-
+
public void setChoices(String string) {
this.choices = string;
}
-
+
public void setPartialSearch(String string) {
this.partialSearch = string;
}
-
+
public void setPartialChars(String string) {
this.partialChars = string;
}
-
+
public void setIgnoreCase(String string) {
this.ignoreCase = string;
}
-
+
public void setFullSearch(String string) {
this.fullSearch = string;
}
@@ -2552,7 +2552,7 @@
protected SubHyperlink subHyperlink;
protected boolean disabled;
protected boolean clientAutocompleteField;
-
+
protected TextField() {
super();
}
@@ -2587,7 +2587,7 @@
Debug.logError("Could not parse the max-length value of the text element: [" + maxlengthStr + "], setting to null; default of no maxlength will be used", module);
}
}
-
+
this.disabled = "true".equals(element.getAttribute("disabled"));
this.clientAutocompleteField = !"false".equals(element.getAttribute("client-autocomplete-field"));
@@ -2609,11 +2609,11 @@
public int getSize() {
return size;
}
-
+
public boolean getDisabled() {
return this.disabled;
}
-
+
public void setDisabled(boolean b) {
this.disabled = b;
}
@@ -2621,7 +2621,7 @@
public boolean getClientAutocompleteField() {
return this.clientAutocompleteField;
}
-
+
public void setClientAutocompleteField(boolean b) {
this.clientAutocompleteField = b;
}
@@ -2686,7 +2686,7 @@
public TextareaField(Element element, ModelFormField modelFormField) {
super(element, modelFormField);
this.setDefaultValue(element.getAttribute("default-value"));
-
+
visualEditorEnable = "true".equals(element.getAttribute("visual-editor-enable"));
visualEditorButtons = FlexibleStringExpander.getInstance(element.getAttribute("visual-editor-buttons"));
readOnly = "true".equals(element.getAttribute("read-only"));
@@ -2741,7 +2741,7 @@
public boolean isReadOnly() {
return readOnly;
}
-
+
/**
* @param r
*/
@@ -2927,7 +2927,7 @@
if (subHyperlinkElement != null) {
this.subHyperlink = new SubHyperlink(subHyperlinkElement, this.getModelFormField());
}
-
+
Element autoCompleteElement = UtilXml.firstChildElement(element, "auto-complete");
if (autoCompleteElement != null) {
this.autoComplete = new AutoComplete(autoCompleteElement);
@@ -2979,15 +2979,15 @@
public void setSubHyperlink(SubHyperlink newSubHyperlink) {
this.subHyperlink = newSubHyperlink;
}
-
+
public AutoComplete getAutoComplete() {
return this.autoComplete;
}
-
+
public void setAutoComplete(AutoComplete newAutoComplete) {
this.autoComplete = newAutoComplete;
}
-
+
public int getOtherFieldSize() {
return this.otherFieldSize;
}
@@ -2995,7 +2995,7 @@
public String getSize() {
return this.size;
}
-
+
/**
* Get the name to use for the parameter for this field in the form interpreter.
* For HTML forms this is the request parameter name.
@@ -3009,7 +3009,7 @@
} else {
baseName = this.modelFormField.name;
}
-
+
baseName += "_OTHER";
Integer itemIndex = (Integer) context.get("itemIndex");
if (itemIndex != null && "multi".equals(this.modelFormField.modelForm.getType())) {
@@ -3067,7 +3067,7 @@
public void renderFieldString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer) throws IOException {
formStringRenderer.renderCheckField(writer, context, this);
}
-
+
public Boolean isAllChecked(Map<String, Object> context) {
String allCheckedStr = this.allChecked.expandString(context);
if (UtilValidate.isNotEmpty(allCheckedStr)) {
@@ -3127,7 +3127,7 @@
public void setImageLocation(String string) {
imageLocation = string;
}
-
+
public String getBackgroundSubmitRefreshTarget(Map<String, Object> context) {
return this.backgroundSubmitRefreshTargetExdr.expandString(context);
}
@@ -3246,11 +3246,11 @@
public String getDefaultOption() {
return this.defaultOption;
}
-
+
public boolean getHideIgnoreCase() {
return this.hideIgnoreCase;
}
-
+
public boolean getHideOptions() {
return this.hideOptions;
}
@@ -3319,7 +3319,7 @@
protected String descriptionFieldName;
protected String targetParameter;
protected SubHyperlink subHyperlink;
-
+
public LookupField(Element element, ModelFormField modelFormField) {
super(element, modelFormField);
this.formName = FlexibleStringExpander.getInstance(element.getAttribute("target-form-name"));
@@ -3358,7 +3358,7 @@
public void setFormName(String str) {
this.formName = FlexibleStringExpander.getInstance(str);
}
-
+
public String getDescriptionFieldName() {
return this.descriptionFieldName;
}
@@ -3366,7 +3366,7 @@
public void setDescriptionFieldName(String str) {
this.descriptionFieldName = str;
}
-
+
public SubHyperlink getSubHyperlink() {
return this.subHyperlink;
}