Dashboard > Wonder > ... > Tutorials > Using a custom EOEditingContext (ERXEC) Subclass
  Wonder Log In View a printable version of the current page.  
  Using a custom EOEditingContext (ERXEC) Subclass
Added by Kieran Kelleher, last edited by Kieran Kelleher on Jul 03, 2007  (view change)
Labels: 
(None)

Create the EditingContext Subclass

public class MyEditingContext extends ERXEC {

    public MyEditingContext(EOObjectStore anObjectStore) {
        super(anObjectStore);
    }

    public MyEditingContext() {
	super();
    }

    // Your custom logic here...

}

Create the ERXEC.DefaultFactory Subclass

public class MyEditingContextFactory extends ERXEC.DefaultFactory {

    public MyEditingContextFactory() {
        super();
    }

    protected EOEditingContext _createEditingContext(EOObjectStore parent) {
        return new MyEditingContext(parent == null ? EOEditingContext.defaultParentObjectStore() : parent);;
    }
}

Tell Wonder to Use Your Custom Factory

In your Application constructor, set your custom editing context factory as the default factory for ERXEC as shown here for example:

public Application() {
        super();

        // Configure the Editing Context factory for my subclass of ERXEC
        ERXEC.setFactory( new MyEditingContextFactory() );

        // More app initialization code......

    }

Creating an Instance of Your Custom Editing Context Subclass

EOEditingContext ec = ERXEC.newEditingContext();

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators