Merged BRANCHES/DEV/BELARUS/HEAD-2010_03_30 to HEAD

19866: ALF-790: WCM - Underscore not displaying for enumeration values

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20005 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2010-04-27 11:38:22 +00:00
parent cfb957d951
commit 1225970db4
5 changed files with 28 additions and 5 deletions

View File

@@ -118,6 +118,7 @@ public class Schema2XForms implements Serializable
private final String action;
private final SubmitMethod submitMethod;
private final String base;
private final boolean formatCaption;
@SuppressWarnings("unchecked")
private final Stack parentStack = new Stack();
@@ -145,13 +146,15 @@ public class Schema2XForms implements Serializable
*
* @param action _UNDOCUMENTED_
* @param submitMethod _UNDOCUMENTED_
* @param formatCaption
*/
public Schema2XForms(final String action,
final SubmitMethod submitMethod,
final String base)
final String base, final boolean formatCaption)
{
reset();
this.formatCaption = formatCaption;
this.action = action;
this.submitMethod = submitMethod;
this.base = base;
@@ -2389,6 +2392,10 @@ public class Schema2XForms implements Serializable
*/
public String createCaption(String text)
{
if (formatCaption == false)
{
return text;
}
// if the word is all upper case, then set to lower case and continue
if (text.equals(text.toUpperCase()))
{

View File

@@ -106,6 +106,7 @@ public class Schema2XFormsProperties
private final NamespaceService namespaceService;
private final NodeService nodeService;
private final SearchService searchService;
private boolean formatCaption = true;
private String[] locations;
public Schema2XFormsProperties(final ContentService contentService,
@@ -197,6 +198,17 @@ public class Schema2XFormsProperties
this.locations = locations;
}
public boolean isFormatCaption()
{
return formatCaption;
}
public void setFormatCaption(boolean formatCaption)
{
this.formatCaption = formatCaption;
}
public String toString()
{
return (this.getClass().getName() + "{" +

View File

@@ -643,7 +643,7 @@ public class Schema2XFormsTest
{
final Schema2XForms s2xf = new Schema2XForms("/test_action",
Schema2XForms.SubmitMethod.POST,
"echo://fake.base.url");
"echo://fake.base.url", true);
return s2xf.buildXForm(instanceDocument,
schemaDocument,
rootElementName,

View File

@@ -129,14 +129,15 @@ public class XFormsBean implements Serializable
public XFormsSession(final Document formInstanceData,
final String formInstanceDataName,
final Form form,
final String baseUrl)
final String baseUrl,
final boolean formatCaption)
{
this.formInstanceData = formInstanceData;
this.formInstanceDataName = formInstanceDataName;
this.form = form;
this.schema2XForms = new Schema2XForms(/* "/ajax/invoke/XFormsBean.handleAction" */ null,
Schema2XForms.SubmitMethod.POST,
/* baseUrl */ "alfresco:" + XFormsBean.class.getName());
/* baseUrl */ "alfresco:" + XFormsBean.class.getName(), formatCaption);
}
public void destroy()
@@ -314,7 +315,7 @@ public class XFormsBean implements Serializable
request.getServerName() + ':' +
request.getServerPort() +
request.getContextPath());
return this.new XFormsSession(formInstanceData, formInstanceDataName, form, baseUrl);
return this.new XFormsSession(formInstanceData, formInstanceDataName, form, baseUrl, getSchema2XFormsProperties().isFormatCaption());
}
/**