checkpoint of xforms improvements

- mostly functional hgroup implementation
- refactoring to support hgroups, make widgets behave better as inline elements
- figured out a way to get rid of dojo's inflight error watcher
- partial support for totalDigits (blocked by a dojo bug)
- improved support for length schema constraint
- refactoring of create widget code on the way to supporting config based on schema type, xform type, and appearance
- fix for silly bug in select workflow portion of create form wizard

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5573 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2007-04-27 22:33:37 +00:00
parent ab77d65cfa
commit 1b898fb23e
11 changed files with 827 additions and 476 deletions

View File

@@ -20,7 +20,7 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.web.bean.wcm;
@@ -657,7 +657,7 @@ public class CreateWebContentWizard extends BaseContentWizard
}
/**
* @param formName Sets the currently selected form
* @param form Sets the currently selected form
*/
public void setFormName(final String formName)
{

View File

@@ -19,7 +19,7 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */
* http://www.alfresco.com/legal/licensing */
package org.alfresco.web.forms;
import freemarker.ext.dom.NodeModel;

View File

@@ -19,7 +19,7 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */
* http://www.alfresco.com/legal/licensing */
package org.alfresco.web.forms;
import org.alfresco.service.cmr.repository.NodeRef;

View File

@@ -19,27 +19,22 @@
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing" */
* http://www.alfresco.com/legal/licensing */
package org.alfresco.web.forms;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import freemarker.ext.dom.NodeModel;
import freemarker.template.SimpleDate;
import freemarker.template.SimpleHash;
import freemarker.template.SimpleScalar;
import freemarker.template.TemplateHashModel;
import freemarker.template.TemplateModel;
import freemarker.template.TemplateModelException;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.*;
import javax.faces.context.FacesContext;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.WCMAppModel;
@@ -49,16 +44,16 @@ import org.alfresco.repo.template.TemplateNode;
import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.avm.AVMService;
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.service.cmr.repository.AssociationRef;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.TemplateException;
import org.alfresco.service.cmr.repository.TemplateService;
import org.alfresco.service.namespace.DynamicNamespacePrefixResolver;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.*;
import org.alfresco.service.cmr.remote.AVMRemote;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wcm.AVMConstants;
@@ -66,15 +61,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import freemarker.ext.dom.NodeModel;
import freemarker.template.SimpleDate;
import freemarker.template.SimpleHash;
/**
* Implementation of a rendering engine template

View File

@@ -2320,6 +2320,10 @@ public class Schema2XForms
", maxInc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) +
", minExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINEXCLUSIVE) +
", maxExc: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXEXCLUSIVE) +
", totalDigits: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_TOTALDIGITS) +
", length: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_LENGTH) +
", minLength: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINLENGTH) +
", maxLength: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH) +
", fractionDigits: " + controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS) +
", builtInTypeName: " + SchemaUtil.getBuiltInTypeName(controlType) +
", builtInType: " + SchemaUtil.getBuiltInType(controlType) +
@@ -2362,32 +2366,49 @@ public class Schema2XForms
NamespaceConstants.XFORMS_PREFIX + ":ref",
".");
}
else if (controlType.getBounded() &&
controlType.getNumeric() &&
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) != null &&
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) != null)
else if (controlType.getNumeric())
{
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":range");
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":start",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE));
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":end",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE));
String fractionDigits = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS);
if (fractionDigits == null || fractionDigits.length() == 0)
if (controlType.getBounded() &&
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE) != null &&
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE) != null)
{
final short builtInType = SchemaUtil.getBuiltInType(controlType);
fractionDigits = (builtInType >= XSConstants.INTEGER_DT && builtInType <= XSConstants.POSITIVEINTEGER_DT
? "0"
: null);
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":range");
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":start",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE));
result.setAttributeNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":end",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE));
}
if (fractionDigits != null)
else
{
result = xformsDocument.createElementNS(NamespaceConstants.XFORMS_NS,
NamespaceConstants.XFORMS_PREFIX + ":input");
}
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS))
{
String fractionDigits = controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_FRACTIONDIGITS);
if (fractionDigits == null || fractionDigits.length() == 0)
{
final short builtInType = SchemaUtil.getBuiltInType(controlType);
fractionDigits = (builtInType >= XSConstants.INTEGER_DT && builtInType <= XSConstants.POSITIVEINTEGER_DT
? "0"
: null);
}
if (fractionDigits != null)
{
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
NamespaceService.ALFRESCO_PREFIX + ":fractionDigits",
fractionDigits);
}
}
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_TOTALDIGITS))
{
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
NamespaceService.ALFRESCO_PREFIX + ":fractionDigits",
fractionDigits);
NamespaceService.ALFRESCO_PREFIX + ":totalDigits",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_TOTALDIGITS));
}
}
else
@@ -2399,14 +2420,27 @@ public class Schema2XForms
{
appearance = "full";
}
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH) ||
controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_LENGTH))
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_LENGTH))
{
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
NamespaceService.ALFRESCO_PREFIX + ":maxLength",
(controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH)
? controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH)
: controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH)));
NamespaceService.ALFRESCO_PREFIX + ":length",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_LENGTH));
}
else if(controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MINLENGTH) ||
controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH))
{
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MINLENGTH))
{
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
NamespaceService.ALFRESCO_PREFIX + ":minlength",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINLENGTH));
}
if (controlType.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXLENGTH))
{
result.setAttributeNS(NamespaceService.ALFRESCO_URI,
NamespaceService.ALFRESCO_PREFIX + ":maxlength",
controlType.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXLENGTH));
}
}
}
this.setXFormsId(result);

View File

@@ -231,7 +231,7 @@ public class SchemaUtil
final XSImplementation xsImpl = (XSImplementation)
registry.getDOMImplementation("XS-Loader");
final XSLoader schemaLoader = xsImpl.createXSLoader(null);
final DOMConfiguration config = schemaLoader.getConfig();
final DOMConfiguration config = (DOMConfiguration)schemaLoader.getConfig();
final LinkedList<DOMError> errors = new LinkedList<DOMError>();
config.setParameter("error-handler", new DOMErrorHandler()
{