Basic Customization > User Interface Customization > Presenting Information in the UI > Customizing the Find Number Field
  
Customizing the Find Number Field
Outof-the-box, the Find Number Field of the Edit Structure Window in the Product Structure browser will not accept values which contain spaces. However, the Find Number field can be customized to accept values that include spaces, including leading or trailing spaces.
* 
If you perform this customization you must maintain and carry-forward this customization when you move to a later release of Windchill.
* 
If you want to allow leading or trailing spaces, perform steps 1 and 3 below; otherwise step 2 is sufficient.
1. The entry "wt.load.preserveSpace=true" has to be added to the file Windchill\codebase\wt.properties to allow for leading/trailing spaces.
2. To customize the logic in this field, perform the following steps:
a. Implement the interface "ValidateFindNumberDelegate.java"
b. Override the 'validateFindNumbers (String[])' method as described in the sample code provided below.
c. Ensure that the implementation throws a WTPropertyVetoException (as in the example) if any of the contraints are violated.
d. Register this new delegate in Windchill\codebase\service.properties.xconf:
There is a section with the following entry in this file:
<!--
The wt.part.ValidateFindNumbersDelegate service.

Delegate validation for Find Numbers on WTPartUsageLink
objects subclasses thereof
-->
<Service context="default"
name="wt.part.ValidateFindNumbersDelegate">
<Option cardinality="duplicate" requestor="java.lang.Object"
serviceClass="wt.part.DefaultValidateFindNumbersDelegate"/>
</Service>
Replace wt.part.DefaultValidateFindNumbersDelegate with the full path and name of the new delegate that was just created.
e. Run "xconfmanager -Fpv" to propagate the changes.
f. Create an rbinfo entry with the message you want to display when an error occurs.
3. If the customization rules pertaining to leading/trailing spaces have to be obeyed while loading data from a load file as well, then the following code samples provide an example of how to do this in the method "getValue(String, Hashtable, HashTable, boolean)".
OOTB Implementation
protected static String getValue( String name, Hashtable nv,
Hashtable cmd_line, boolean required ) throws WTException {
String value =
LoadServerHelper.getValue(name,nv,cmd_line,required?LoadServerH
elper.REQUIRED:LoadServerHelper.NOT_REQUIRED);

if (value != null) {
value = value.trim();
if (value.equals("")) {
value = null;
}
}

return value;
}
Customized implementation allowing leading and trailing spaces while loading from a file:
protected static String getValue( String name, Hashtable nv,
Hashtable cmd_line, boolean required ) throws WTException {
String value =
LoadServerHelper.getValue(name,nv,cmd_line,required?LoadServerH
elper.REQUIRED:LoadServerHelper.NOT_REQUIRED);

// Don't trim leading/trailing spaces if reading Find
Number field.
if(!name.equalsIgnoreCase("findNumber"))
{
if (value != null) {
value = value.trim();
if (value.equals("")) {
value = null;
}
}
}

return value;
}