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

@@ -155,6 +155,9 @@
<value>classpath:alfresco/messages/webclient</value> <value>classpath:alfresco/messages/webclient</value>
</list> </list>
</property> </property>
<property name="formatCaption">
<value>${xforms.formatCaption}</value>
</property>
</bean> </bean>
<!-- ===================================== --> <!-- ===================================== -->

View File

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

View File

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

View File

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

View File

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