Search This Blog

Thursday, September 21, 2017

Create a listener on a field from another field class in Maximo

To create a field validation class we usually extend the mbovalueadapter which implements the mbovaluelistener.

If you want to create a listener on another field B from the field validation class of Field A here is the process.

Field A can have both domain and a field validation class and in our case we have a list from a table so we can extend the MaxtableDomain

In the init method of the field validation class of Field A create another instance of MboValueListener 

class FieldA extends MaxtableDomain{

public init(){
MboValueListener mvl = new OurCustomListener(getmbovalue(FieldB);
getMboValue.addListener(mvl);
}
}



In the above case as the page loads the init of Field A will create a listener in memory for field B and will listen to all 
the methods of a normal field validation class( Validat/action etc)

Implement the custom listener class 

class OurCustomListener extends mbovalueadapter {

constructor -- with mbovalue 

public action(MboValue mbv){
// this will be called whenever the FieldB changes 
}

}



So this way we can create listeners for multiple fields from one field class, this is use full for utility classes in Maximo where you don't want to change field validation at different places for FieldB but you have a generic FieldA and you can do all the changes there.


No comments:

Post a Comment