Hi,

I have recently read an article on the IBM developerWorks website
(http://www.ibm.com/developerworks/library/x-xmlbeanse/index.html )
that describes how to use interface extensions to utilize events within
XMLBeans.  I am able to register event listeners, fire events, and do
everything else they describe in the article but I am having a problem
where I set one XmlObject to another through use of the
XmlObject::set(XmlObject arg) method which does not execute my preSet()
and postSet() methods.

This is an example using the PurchaseOrderDocument example found on the
XMLBeans tutorial page: 

public static void main(String[] args){
  PurchaseOrder po_one =
PurchaseOrderDocument.PurchaseOrder.Factory.newInstance();
    
  po_one.addModelChangeListener(new IModelChangeListener(){ 
    public void modelChange(ModelChangeEvent evt){
      System.err.println("EVENT");
    }
  });
    
  PurchaseOrder po_two =
PurchaseOrderDocument.PurchaseOrder.Factory.newInstance();
  
  po_one.addNewCustomer(); // prints "EVENT" on stderr
  po_one.set(po_two);      // does not print anything
  po_one.addNewCustomer(); // prints "EVENT" on stderr
}


I am using an extremely stripped down version of the code on the IBM's
website for the static implementation files so that my preSet and
postSet methods basically do this:

public static boolean preSet(...){
  return true;
}


public static void postSet(XmlObject xo, ...){
  ((IModelChangeListener)xo).fireModelChangeEvent(new
ModelChangeEvent(...));
  
  return;
}


Is this happening because po_one.set(po_two) isn't really changing
anything about po_one except what it's pointing to in memory?


Thank you,
Bryan Worrell

__
Bryan Worrell    
The MITRE Corporation
[EMAIL PROTECTED] 





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to