compare()

This method is optional.

It only has to be implemented at the class level (not the prototype level) for ControlWrappers that meet both of the following conditions:

  • The value edited by the control is of a complex type, i.e. the type is specified by a BOM class.
  • Instances of the control are allowed to occur in grid panes.

In these situations, if the grid pane has enabled sorting, the form needs to know how the complex objects should be sorted. The compare method is used in performing this sorting.

Method Arguments:

  • value1: This is the first object to compare.
  • value2: This is the second object to compare.

Method Return Value:

  • Returns a number value:
    • < 0: if value1 is less than value2
    • 0: if value1 is equal to value2
    • > 0: if value1 is greater than value2