Hi there
I am trying to make an attribute read-only depending on a complex logic. The logic is too complex (a combination of roles and document properties) so that I cannot use readonly_attributes or to the dictionary for the implementation.
I have extended com.documentum.webcomponent.library.contenttransfer.importcontent.ImportContent, in onRenderEnd(), simplified, I have the following code:
if (myComplexLogicApplies()) {
DocbaseAttributeList docbaseattributelist = (DocbaseAttributeList) getControl("attrlist",
com.documentum.web.formext.control.docbase.DocbaseAttributeList.class);
for (Iterator iterator = docbaseattributelist.getContainedControls(); iterator.hasNext(); ) {
Control control = (Control) iterator.next();
if (control instanceof DocbaseAttribute) {
DocbaseAttribute attribute = (DocbaseAttribute) control;
String attributeName = attribute.getAttribute();
if (attributeName.equals(attrName)) {
if (!attribute.isReadonly()) {
attribute.setReadonly(true);
for (Iterator iterator2 = attribute.getContainedControls(); iterator2.hasNext();) {
Control control2 = (Control) iterator2.next();
if (control2 instanceof AttributeValueControl) {
AttributeValueControl value = (AttributeValueControl) control2;
if (!value.isReadonly()) {
value.setReadonly(true);
DfLogger.warn(this, "Set read-only: " + value, null, null);
return true;
}
}
}
}
}
}
}
That actually works, but the screen has been rendered already so the attribute is read-only after I refresh the page.
How can I ensure the attributes in attributelist are re-rendered?
Is there an earlier point in ImportContent than onRenderEnd() where attrlist is initialized? (In onRender() and after a super.onRender(), this code above doesn't work).
David