Subclassing a Cocoa class while in a Java package
Subclassing a Cocoa class while in a Java package
- Subject: Subclassing a Cocoa class while in a Java package
- From: Frédéric BLANC <email@hidden>
- Date: Tue, 11 Feb 2003 15:14:49 +0100 (CET)
DevTools: December 2002
Context: Cocoa-Java app.
Subject: Subclassing NSTableView while in a Java package
===
Hi there,
In a Java-based project, we define our classes in a package named
"com.acme.ourproduct".
In our main .nib, we've got a central "NSTableView" which needs to behave
slightly differently than a common NSTableView does.
So, we have to define a new class ("OurNSTableView"), subclass of NSTableView,
to code those changes.
Then, we think we should "cast" it in IB (from NSTableView to
com.acme.ourproduct.OurNSTableView.)
And, there is our problem: what we want would be to define our class INSIDE our
package...
In IB, the class tab seems to only allows package-based classes (ex. :
"com.acme.ourproduct.OurNSTableView") when derivating JDK Java classes (like
java.lang.Object.)
When creating our fully-named class "under" NSTableView, the name is cancelled
(since invalid because of the dots.)
Note: It looks like a bug since this class name is then editable in the
inspector - where dots are then allowed...
2 situations:
1) Defining our class "under" java.lang.Object allows us to name it w/ its full
name BUT forbids us to "cast" the tableView to our class - since it doesn't then
appear in the "Custom Class" part of the inspector.
2) Defining our class "under" NSTableView" allows us to "cast" the tableView to
our class - 'cause it then show up in the inspector - BUT forbids us to use the
package-based naming (thus, at runtime, simply failed - don't remember exactly
which error occurs since I'm not currently in front of a Mac.)
Thanks a lot in advance for any idea (what to do, what is better, etc.) and
answer around this problem,
- Fred
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.