Re: [SOLVED - But...] "Subclassing NSTableView while in a Java package"
Re: [SOLVED - But...] "Subclassing NSTableView while in a Java package"
- Subject: Re: [SOLVED - But...] "Subclassing NSTableView while in a Java package"
- From: Rams <email@hidden>
- Date: Fri, 14 Feb 2003 16:18:48 -0500
Looks like you forgot about NSCoding... Without creating the two
methods in your subclass, they NSArchiver will crap out... Add this
and it works.
package com.acme.ourproduct;
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;
public class MyTableView extends NSTableView {
public MyTableView(NSCoder decoder, long token) {
super(decoder, token);
}
public void encodeWithCoder(NSCoder encoder) {
super.encodeWithCoder(encoder);
}
}
On Friday, February 14, 2003, at 09:51 AM, Fridiric BLANC wrote:
Hi,
Thanks to Enrico Stamigna, my Java-based problem (cf. subject) is
solved: I was
plain wrong, sorry, since there's no bug in IB here but solely
consistency
checking based upon superclass while creating and naming a
newly-created subclass.
Indeed, when you're subclassing a Java JDK class, you're allowed to
use dots in
the name of the class (thus, to use a package-based name!); this is
due to the
fact that the radio button for this class is automatically set to
"Java". But,
when you're subclassing a Cocoa class, you're automatically in the
"Objective-C"
case (thus, the cancelling of your dots-based classname!)
The solution when subclassing NSTableView to include it in your own
Java package
was then to:
1) Subclass NSTableView (you can let the default "MyTableView" name);
2) Click "Java" in the inspector;
3) Change its name to "my.personal.package.MyTableView"
Then, you can assign in the "Custom Class" section of the inspector
your custom
class as the type of any NSTableView widget! Thanks a lot to all of
you and
especially to Enrico.
===
But... this hasn't solved my initial problem which was to specialized
NSTableView with custom code! Indeed, now that I can assign MY
package-based
class to the widget, I thought it will be kind of simple to just
overload some
methods (to catch special key events, for example.) But, it seems I
can't run
such a project. To illustrate my new problem, I've done a tiny project
- which
one could find at:
http://blanc.free.fr/pub/temp/IB_TableView_package.sit.
The logic behind it was to ONLY build the simpliest .nib (a window w/ a
NSTableView reassigned to my custom subclass - which is the minimal
NSTableView
subclass!) When I run this built app, I've got the following trace
before it
shortly quits:
<<
ObjCJava WARNING:
jobjc_jvm_newObject(): constructor with signature
(Ljava/io/InputStream;)V on class java/io/ObjectInputStream failed
(should morph the java exception)
2003-02-14 00:16:08.987 IB_TableView_package[875] AppKitJava: uncaught
exception OBJCJava_RUNTIME_EXCEPTION ((null))
2003-02-14 00:16:08.989 IB_TableView_package[875] AppKitJava: exception
= (null description)
2003-02-14 00:16:08.991 IB_TableView_package[875] AppKitJava:
terminating.
IB_TableView_package has exited with status 1.
Thanks to anyone who could help me here.
Note: Some people on those lists were kind enough to participate. I'll
answer to
everyone, I just found the needed time until then. Thanks a lot for
your
suggestions, they'll help me soon.
Bye,
- 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.
--
"Intel Inside" - It's not a marketing gimmick, it's a warning label.
_______________________________________________
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.