[OFBiz] SVN: r4813 -
trunk/framework/widget/src/org/ofbiz/widget/html
jonesde at svn.ofbiz.org
jonesde at svn.ofbiz.org
Tue Apr 12 20:21:24 EDT 2005
Author: jonesde
Date: 2005-04-12 19:21:21 -0500 (Tue, 12 Apr 2005)
New Revision: 4813
Modified:
trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java
Log:
Added a method that allows passing in the context as a MapStack, for use with forms that are rendered from an FTL file that is included in a screen widget
Modified: trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java
===================================================================
--- trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java 2005-04-13 00:20:33 UTC (rev 4812)
+++ trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java 2005-04-13 00:21:21 UTC (rev 4813)
@@ -1,7 +1,7 @@
/*
* $Id$
*
- * Copyright (c) 2003 The Open For Business Project - www.ofbiz.org
+ * Copyright (c) 2003-2005 The Open For Business Project - www.ofbiz.org
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -33,6 +33,7 @@
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.collections.MapStack;
import org.ofbiz.widget.form.FormFactory;
import org.ofbiz.widget.form.FormStringRenderer;
import org.ofbiz.widget.form.ModelForm;
@@ -92,12 +93,28 @@
}
Map uiLabelMap = (Map) request.getAttribute("uiLabelMap");
- Debug.logInfo("Got uiLabelMap: " + uiLabelMap, module);
if (uiLabelMap != null && uiLabelMap.size() > 0 && context.get("uiLabelMap") == null) {
+ Debug.logInfo("Got uiLabelMap: " + uiLabelMap, module);
context.put("uiLabelMap", uiLabelMap);
}
}
+ public String renderFormString(Object contextStack) {
+ if (contextStack instanceof MapStack) {
+ return renderFormString((MapStack) contextStack);
+ } else {
+ Debug.logWarning("WARNING: call renderFormString with a non-MapStack: " + (contextStack == null ? "null" : contextStack.getClass().getName()), module);
+ return renderFormString();
+ }
+ }
+ public String renderFormString(MapStack contextStack) {
+ // create a new context with the current context on the bottom
+ contextStack.push(this.context);
+ StringBuffer buffer = new StringBuffer();
+ modelForm.renderFormString(buffer, contextStack, renderer);
+ contextStack.pop();
+ return buffer.toString();
+ }
public String renderFormString() {
StringBuffer buffer = new StringBuffer();
modelForm.renderFormString(buffer, context, renderer);
More information about the Svn
mailing list