Hi,

I would like to override a few WODisplayGroup methods, namely displayNextBatch and displayPreviousBatch. Currently my WOComponent has a WODisplayGroup containing a WOBatchNavigationBar used to change the displayed objects on my page. I would like to perform some additional logic before calling the "super" displayNextBatch method.

For example, I want to see if the user currently has a boolean flag set to indicate they are editing the one of the current objects before actually displaying the next batch of objects in the display group.

It seems as if I could simply extend the WODisplayGroup to a custom class, then override the specific methods, and call super when appropriate. However, after doing this, I cannot get the page to even load from the start.

Here is the snippet of modified code

public class LocalizationCodePage extends SecuredPageComponent {
        public MyDisplayGroup localizationCodesDG;
        public LocalizationCode localization;
        public boolean isEditingLocalization;

        public class MyDisplayGroup extends WODisplayGroup {
                public Object displayNextBatch() {
System.out.println("I am about to display the next batch of objects in MyDisplayGroup");
                        if (isEditingLocalization) {
System.out.println("Warning: you are currently editing an existing object in the display group");
                                // TO DO : Eventually put some additional logic 
here
                        }
                        return(super.displayNextBatch());
                }
        }
.
.
.

When I attempt to load the page, I now get :

Error: com.webobjects.foundation.NSForwardException [java.lang.IllegalArgumentException] While trying to set the field "localizationCodesDG" on an object of type LocalizationCodePage we expected a LocalizationCodePage$MyDisplayGroup but received a com.webobjects.appserver.WODisplayGroup with a value of sortOrdering= () qualifier=null localKeys=() insertedObjectDefaultValues={} numberOfObjectsPerBatch=2>. This often happens if you forget to use a formatter.


From researching on the list, I seemed as if I may need to manually change the cooresponding .woo file as well (e.g. change line class=WODisplayGroup to class=MyDisplayGroup).

I edited the .woo file to:

{
    "WebObjects Release" = "WebObjects 5.0";
    encoding = NSMacOSRomanStringEncoding;
    variables = {
        localizationCodesDG = {
            class = MyDisplayGroup;
            dataSource = {
                class = EODatabaseDataSource;
                editingContext = "session.defaultEditingContext";
                fetchSpecification = {
                    class = EOFetchSpecification;
                    entityName = LocalizationCode;
                    fetchLimit = 0;
                    isDeep = YES;
                };
            };
            fetchesOnLoad = YES;
            formatForLikeQualifier = "[EMAIL PROTECTED]";
            localKeys = ();
            numberOfObjectsPerBatch = 2;
            selectsFirstObjectAfterFetch = YES;
sortOrdering = ({class = EOSortOrdering; key = code; selectorName = "compareAscending:"; });
        };
    };
}

After rebuilding and launching my app, I got another error:

Error: com.webobjects.foundation.NSForwardException [java.lang.IllegalArgumentException] Attempt to insert null object into an com.webobjects.foundation.NSMutableDictionary.

Any suggestions?  Sorry again for another newbie question.

Thanks,

Kev

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to