Basic Customization > User Interface Customization > Customizing HTML Clients Using the Windchill JSP Framework > Adding Validation Logic for Actions and Properties > Implementation > Authoring a Validator Class > Implementing a validateSelectedMultiSelectAction Method
  
Implementing a validateSelectedMultiSelectAction Method
Another of the methods that you can override in your Validator implementation is called validateSelectedMultiSelectAction. It is similar to the validateSelectedAction method. The only difference is that this method will be called to validate a multi-select action, and will therefore return multiple results. For example, A user selects “checkout” from a table header to perform the checkout of several selected parts in the table. Should we allow all of the parts to be checked out?
The method signature for validateSelectedMultiSelectAction looks like this:
public UIValidationResultSet validateSelectedAction (String
validationKey, UIValidationCriteria validationCriteria, Locale
locale)
Note that the arguments are identical to those passed to validateSelectedAction. The only difference is that this method returns an object of type UIValidationResultSet, which, as the name suggests, is just a set of UIValidationResult objects.
Pseudo-code for the validateSelectedMultiSelectAction would look like this:
import com.ptc.core.ui.validation.*;

public class MyValidator extends DefaultUIComponentValidator{

public UIValidationResultSet validateSelectedMultiSelectAction
(String
a_key, UIValidationCriteria a_criteria, Locale a_locale){
// get required info from UIValidationCriteria
WTContainerRef parentContainer = a_criteria.getParentContainer();
WTCollection targetObjects = a_criteria.getTargetObjects();
WTPrincipalReference userRef = a_criteria.getUser();
// create result set to return
UIValidationResultSet resultSet = new UIValidationResultSet();
// iterate through target objects
Iterator targetRefIterator = targetObjects.referenceIterator();
while (targetRefIterator.hasNext()){
WTReference targetRef =
(WTReference)targetRefIterator.next();
if (we can allow this action to proceed for this object){
resultSet.addResult(new UIValidationResult(a_key,
targetRef,
UIValidationStatus.PERMITTED, null));
}
else{
resultSet.addResult(new UIValidationResult(a_key,
targetRef,
UIValidationStatus.DENIED, new
UIValidationMsg
(localized text,
UIValidationMsgType.INFO)));
}
}
// return the result set
return resultSet
}
}