• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Overriding WODisplayGroup methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overriding WODisplayGroup methods


  • Subject: Overriding WODisplayGroup methods
  • From: email@hidden
  • Date: Wed, 14 Dec 2005 12:05:25 -0500

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 = "%@*";
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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Overriding WODisplayGroup methods
      • From: Art Isbell <email@hidden>
  • Prev by Date: Re: Help with NSXMLOutputStream/NSSMLInputStream
  • Next by Date: Combo boxes in table columns
  • Previous by thread: Re: Help with NSXMLOutputStream/NSSMLInputStream
  • Next by thread: Re: Overriding WODisplayGroup methods
  • Index(es):
    • Date
    • Thread