How to make ready only "Name & Number" attributes on Part Edit Common Attribute Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
How to make ready only "Name & Number" attributes on Part Edit Common Attribute Page
Version: Windchill 12.1
Use Case: I want make ready only "Name & Number" attributes on Part Edit Common Attribute Page :
Description:
I am unable to figure if I should use data utility or Validator for this.
1. I tried data utility but I didn't triggered as I am able to registered data utility ID since there is no such Edit Common Attribute layout.
public class DisableName extends DefaultDataUtility {
protected static final Logger logger = LogR.getLogger(DisableName.class.getName());
@Override
public UIValidationStatus getDataValue(String filedName, Object object, ModelContext modelContext)
throws WTException {
System.out.println("---- DisableName on Part CommonAttribute Started-------------");
UIValidationStatus status = UIValidationStatus.ENABLED;
System.out.println("---- filedName :" + filedName);
if (modelContext.getDescriptorMode().equals(ComponentMode.EDIT)) {
if (filedName.equalsIgnoreCase("name")|| filedName.equalsIgnoreCase("number") ) {
System.out.println("---- filedName available ");
status = UIValidationStatus.ATTR_HIDDEN_VALUE;
}
}
System.out.println("---- returning status : " + status);
return status;
}
}
2. I tried extending EditPartCommonAttrsActionValidator and used preValidateAttribute, but It also didn't got triggered..
public class PartEditCommonAttributeValidator extends EditPartCommonAttrsActionValidator {
@Override
public UIValidationStatus preValidateAttribute(UIValidationKey var1, UIValidationCriteria var2) {
UIValidationStatus status = super.preValidateAttribute(var1, var2);
System.out.println("---- PartEditCommonAttributeValidator Validator Started-------------");
Persistable launchedFrom = var2.getContextObject().getObject();
System.out.println("launchedFrom" + launchedFrom);
System.out.println("validationKey : " + var1);
status = UIValidationStatus.ATTR_HIDDEN_VALUE;
System.out.println("---- Validator Status : " + status);
return status;
}
}
Can you please help to get correct methodology to implement my requirement.
Thank you in advance.
- Labels:
-
General Customization
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
There are some ACLs that may apply here. See: https://www.ptc.com/en/support/article/CS23471?source=search
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You can do tha Oo TB t from UI :
In type and attribute manager find these attributes on WTPartMaster and set visibility to read only on edit :
- Chapters
- descriptions off, selected
- captions settings, opens captions settings dialog
- captions off, selected
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
This is a modal window. This modal can be closed by pressing the Escape key or activating the close button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Thank you @Fadel
I works for other attribute as you show but not foe name & number. I want to do it for name & number.
Thanks you.
