mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
more ui work
- tweaking img alignment for repeat controls - beginning to implement expand collapse for groups more fixes for 0 to n repeats next: - complete expand collapse for groups - introduce client event model for managing repeat constraints. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4498 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1871,8 +1871,9 @@ public class SchemaFormBuilder
|
|||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("is Attribute " + attr.getAttrDeclaration().getName() + " declared in " + type.getName());
|
LOGGER.debug("is Attribute " + attr.getAttrDeclaration().getName() + " declared in " + type.getName());
|
||||||
|
|
||||||
//check on parent if not recursive
|
//check on parent if not recursive
|
||||||
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) {
|
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||||
|
{
|
||||||
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
||||||
@@ -1880,25 +1881,15 @@ public class SchemaFormBuilder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check on this type (also checks recursively)
|
//check on this type (also checks recursively)
|
||||||
XSObjectList attrs = type.getAttributeUses();
|
final XSObjectList attrs = type.getAttributeUses();
|
||||||
int nb = attrs.getLength();
|
for (int i = 0; i < attrs.getLength() && !found; i++)
|
||||||
int i = 0;
|
{
|
||||||
while (i < nb && !found) {
|
XSAttributeUse anAttr = (XSAttributeUse)attrs.item(i);
|
||||||
XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i);
|
|
||||||
if (anAttr == attr)
|
if (anAttr == attr)
|
||||||
found = true;
|
found = true;
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//recursive call
|
|
||||||
/*if(!found && recursive &&
|
|
||||||
type.getDerivationMethod()==XSConstants.DERIVATION_EXTENSION){
|
|
||||||
XSComplexTypeDefinition base=(XSComplexTypeDefinition) type.getBaseType();
|
|
||||||
if(base!=null && base!=type)
|
|
||||||
found = this.isAttributeDeclaredIn(attr, base, true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("is Attribute " + attr.getName() + " declared in " + type.getName() + ": " + found);
|
LOGGER.debug("is Attribute " + attr.getName() + " declared in " + type.getName() + ": " + found);
|
||||||
|
|
||||||
@@ -1919,8 +1910,9 @@ public class SchemaFormBuilder
|
|||||||
if (attrName.startsWith("@"))
|
if (attrName.startsWith("@"))
|
||||||
attrName = attrName.substring(1);
|
attrName = attrName.substring(1);
|
||||||
|
|
||||||
//check on parent if not recursive
|
//check on parent if not recursive
|
||||||
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION) {
|
if (!recursive && type.getDerivationMethod() == XSConstants.DERIVATION_EXTENSION)
|
||||||
|
{
|
||||||
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
XSComplexTypeDefinition parent = (XSComplexTypeDefinition) type.getBaseType();
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
LOGGER.debug("testing if it is not on parent " + parent.getName());
|
||||||
@@ -1928,30 +1920,21 @@ public class SchemaFormBuilder
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//check on this type (also checks recursively)
|
//check on this type (also checks recursively)
|
||||||
XSObjectList attrs = type.getAttributeUses();
|
final XSObjectList attrs = type.getAttributeUses();
|
||||||
int nb = attrs.getLength();
|
for (int i = 0; i < attrs.getLength() && !found; i++)
|
||||||
int i = 0;
|
{
|
||||||
while (i < nb && !found) {
|
final XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i);
|
||||||
XSAttributeUse anAttr = (XSAttributeUse) attrs.item(i);
|
if (anAttr != null)
|
||||||
if (anAttr != null) {
|
{
|
||||||
String name = anAttr.getName();
|
String name = anAttr.getName();
|
||||||
if (name == null || name.length() == 0)
|
if (name == null || name.length() == 0)
|
||||||
name = anAttr.getAttrDeclaration().getName();
|
name = anAttr.getAttrDeclaration().getName();
|
||||||
if (attrName.equals(name))
|
if (attrName.equals(name))
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//recursive call -> no need
|
|
||||||
/*if(!found && recursive &&
|
|
||||||
type.getDerivationMethod()==XSConstants.DERIVATION_EXTENSION){
|
|
||||||
XSComplexTypeDefinition base=(XSComplexTypeDefinition) type.getBaseType();
|
|
||||||
if(base!=null && base!=type)
|
|
||||||
found = this.isAttributeDeclaredIn(attrName, base, true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
if (LOGGER.isDebugEnabled())
|
if (LOGGER.isDebugEnabled())
|
||||||
LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName() + ": " + found);
|
LOGGER.debug("is Attribute " + attrName + " declared in " + type.getName() + ": " + found);
|
||||||
|
|
||||||
@@ -2122,7 +2105,6 @@ public class SchemaFormBuilder
|
|||||||
: pathToRoot + "/" + elementName);
|
: pathToRoot + "/" + elementName);
|
||||||
|
|
||||||
final Element newDefaultInstanceElement = xForm.createElement(elementName);
|
final Element newDefaultInstanceElement = xForm.createElement(elementName);
|
||||||
defaultInstanceElement.appendChild(newDefaultInstanceElement);
|
|
||||||
if (element.getConstraintType() != XSConstants.VC_NONE)
|
if (element.getConstraintType() != XSConstants.VC_NONE)
|
||||||
{
|
{
|
||||||
Node value = xForm.createTextNode(element.getConstraintValue());
|
Node value = xForm.createTextNode(element.getConstraintValue());
|
||||||
@@ -2139,7 +2121,11 @@ public class SchemaFormBuilder
|
|||||||
path);
|
path);
|
||||||
|
|
||||||
// update the default instance
|
// update the default instance
|
||||||
if (this.getOccurance(element).isRepeated())
|
if (this.getOccurance(element).minimum == 0)
|
||||||
|
{
|
||||||
|
defaultInstanceElement.appendChild(newDefaultInstanceElement.cloneNode(true));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.getOccurance(element).minimum; i++)
|
for (int i = 0; i < this.getOccurance(element).minimum; i++)
|
||||||
{
|
{
|
||||||
@@ -3175,8 +3161,8 @@ public class SchemaFormBuilder
|
|||||||
// static string (see bug #1172541 on sf.net)
|
// static string (see bug #1172541 on sf.net)
|
||||||
|
|
||||||
String nodeset = pathToRoot;
|
String nodeset = pathToRoot;
|
||||||
// if (o.isRepeated())
|
if (o.isRepeated() && o.minimum == 0)
|
||||||
// nodeset = pathToRoot + "[position() != last()]";
|
nodeset = pathToRoot + "[position() != last()]";
|
||||||
|
|
||||||
bindElement.setAttributeNS(XFORMS_NS,
|
bindElement.setAttributeNS(XFORMS_NS,
|
||||||
SchemaFormBuilder.XFORMS_NS_PREFIX + "nodeset",
|
SchemaFormBuilder.XFORMS_NS_PREFIX + "nodeset",
|
||||||
@@ -3391,6 +3377,7 @@ public class SchemaFormBuilder
|
|||||||
|
|
||||||
LOGGER.debug("walking bind " + bind.getAttributeNS(XFORMS_NS, "id"));
|
LOGGER.debug("walking bind " + bind.getAttributeNS(XFORMS_NS, "id"));
|
||||||
String s = bind.getAttributeNS(XFORMS_NS, "nodeset");
|
String s = bind.getAttributeNS(XFORMS_NS, "nodeset");
|
||||||
|
s = s.replaceAll("^([^\\[]+).*$", "$1");
|
||||||
if (bindToRepeat.containsKey(bind) && !r.equals(bindToRepeat.get(bind)))
|
if (bindToRepeat.containsKey(bind) && !r.equals(bindToRepeat.get(bind)))
|
||||||
{
|
{
|
||||||
s += "[index(\'" + bindToRepeat.get(bind).getAttributeNS(XFORMS_NS, "id") + "\')]";
|
s += "[index(\'" + bindToRepeat.get(bind).getAttributeNS(XFORMS_NS, "id") + "\')]";
|
||||||
|
@@ -748,6 +748,13 @@ dojo.declare("alfresco.xforms.Group",
|
|||||||
this.domNode.style.top = "0px";
|
this.domNode.style.top = "0px";
|
||||||
this.domNode.style.left = "0px";
|
this.domNode.style.left = "0px";
|
||||||
this.domNode.style.width = "100%";
|
this.domNode.style.width = "100%";
|
||||||
|
if (djConfig.isDebug)
|
||||||
|
{
|
||||||
|
var idNode = document.createElement("div");
|
||||||
|
idNode.style.backgroundColor = "red";
|
||||||
|
idNode.appendChild(document.createTextNode(this.id));
|
||||||
|
this.domNode.appendChild(idNode);
|
||||||
|
}
|
||||||
return this.domNode;
|
return this.domNode;
|
||||||
},
|
},
|
||||||
_updateDisplay: function()
|
_updateDisplay: function()
|
||||||
@@ -803,6 +810,7 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
{ src: "arrow_down", action: this._moveRepeatItemDown_handler },
|
{ src: "arrow_down", action: this._moveRepeatItemDown_handler },
|
||||||
{ src: "minus", action: this._removeRepeatItem_handler }
|
{ src: "minus", action: this._removeRepeatItem_handler }
|
||||||
];
|
];
|
||||||
|
var repeatControlsWidth = 0;
|
||||||
for (var i = 0; i < images.length; i++)
|
for (var i = 0; i < images.length; i++)
|
||||||
{
|
{
|
||||||
var img = document.createElement("img");
|
var img = document.createElement("img");
|
||||||
@@ -810,15 +818,20 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
images[i].src + ".gif"));
|
images[i].src + ".gif"));
|
||||||
img.style.width = "16px";
|
img.style.width = "16px";
|
||||||
img.style.height = "16px";
|
img.style.height = "16px";
|
||||||
img.style.marginRight = "4px";
|
img.style.marginLeft = (i == 0 ? 5 : 0) + "px";
|
||||||
img.align = "baseline";
|
img.style.marginRight = "5px";
|
||||||
|
img.style.marginTop = "2px";
|
||||||
|
img.style.marginBottom = "2px";
|
||||||
img.repeatItem = child;
|
img.repeatItem = child;
|
||||||
img.repeat = this;
|
img.repeat = this;
|
||||||
|
repeatControlsWidth += (parseInt(img.style.width) +
|
||||||
|
parseInt(img.style.marginRight) +
|
||||||
|
parseInt(img.style.marginLeft));
|
||||||
child.repeatControls.appendChild(img);
|
child.repeatControls.appendChild(img);
|
||||||
dojo.event.connect(img, "onclick", this, images[i].action);
|
dojo.event.connect(img, "onclick", this, images[i].action);
|
||||||
}
|
}
|
||||||
child.repeatControls.style.position = "relative";
|
child.repeatControls.style.position = "relative";
|
||||||
child.repeatControls.style.width = 4 * (16 + 4) + "px";
|
child.repeatControls.style.width = repeatControlsWidth + "px";
|
||||||
|
|
||||||
child.repeatControls.style.whiteSpace = "nowrap";
|
child.repeatControls.style.whiteSpace = "nowrap";
|
||||||
child.repeatControls.style.border = "1px solid black";
|
child.repeatControls.style.border = "1px solid black";
|
||||||
@@ -1018,12 +1031,9 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
requiredImage.style.marginRight = "5px";
|
requiredImage.style.marginRight = "5px";
|
||||||
|
|
||||||
d.appendChild(requiredImage);
|
d.appendChild(requiredImage);
|
||||||
// requiredImage.style.position = "relative";
|
|
||||||
// requiredImage.style.top = "0px";
|
|
||||||
// requiredImage.style.left = "0px";
|
|
||||||
requiredImage.style.visibility = "hidden";
|
requiredImage.style.visibility = "hidden";
|
||||||
|
|
||||||
var labelElement = document.createTextNode(this.parent.getLabel());//document.createElement("span");
|
var labelElement = document.createTextNode(this.parent.getLabel());
|
||||||
d.appendChild(labelElement);
|
d.appendChild(labelElement);
|
||||||
|
|
||||||
var addElement = document.createElement("img");
|
var addElement = document.createElement("img");
|
||||||
@@ -1031,9 +1041,9 @@ dojo.declare("alfresco.xforms.Repeat",
|
|||||||
addElement.setAttribute("src", WEBAPP_CONTEXT + "/images/icons/plus.gif");
|
addElement.setAttribute("src", WEBAPP_CONTEXT + "/images/icons/plus.gif");
|
||||||
addElement.style.width = "16px";
|
addElement.style.width = "16px";
|
||||||
addElement.style.height = "16px";
|
addElement.style.height = "16px";
|
||||||
addElement.style.position = "absolute";
|
addElement.align = "absmiddle";
|
||||||
addElement.style.top = "0px";
|
addElement.style.marginLeft = "5px";
|
||||||
addElement.style.right = 5 + (16 * 4) + "px";
|
// addElement.style.opacity = .2;
|
||||||
|
|
||||||
dojo.event.connect(addElement, "onclick", this, this._insertRepeatItemBefore_handler);
|
dojo.event.connect(addElement, "onclick", this, this._insertRepeatItemBefore_handler);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user