• 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
How to subclass NSTableView in java ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to subclass NSTableView in java ?


  • Subject: How to subclass NSTableView in java ?
  • From: Julien Chiron <email@hidden>
  • Date: Tue, 17 Sep 2002 13:43:09 +0200

Hi dear cocoa developpers.

I'm new on this list, so forgive me if the question has ever been answered to.
My problem is that I need my tableviews to drop informationss on the Finder and other applications supporting text dropping.
When I drag a row from my tableview to any other window of my application taht supports drop, it works well, but when I drop onto the desktop or TextEdit, the drop is refused.
I read that, in order to drop from a tableView to another application, I need to subclass NSTableView and make it override draggingSourceOperationMaskForLocal method to return somithing else than DragOperationNone.
That is what I did.
I made the following class :

###

public class DraggableNSTableView extends NSTableView {
public int draggingSourceOperationMaskForLocal(boolean isLocal)
{
if (delegate() != null)
{
NSSelector theSel = (NSSelector) new NSSelector("draggingSourceOperationMaskForLocal", new Class[] {Boolean.class});
if (theSel != null && theSel.implementedByObject(delegate()))
{
try
{
return ((Integer)theSel.invoke(delegate(), new Boolean(isLocal))).intValue();
}
catch (IllegalAccessException ex) {}
catch (java.lang.reflect.InvocationTargetException ex2) {}
catch (NoSuchMethodException ex3) {}
}
}
return NSDraggingInfo.DragOperationNone;
}
}

###

I declared it in my nib file and changed the custom class of my tableView to this class.
It compile well, but when I run the application, I get a java.io.StreamCorruptedException while loading the window from the nib file.

My questions are:

1_ Do I really need to subclass NSTableView to do this job while it could be easier to implement the draggingSourceOperationMaskForLocal in the window controller?
2_ Do I need to override any other method from NSTableView to make my class to work ?

thanks very much for your help.

best regards

Julien Chiron
Laboratoire de Valorisation de la Chimie Fine
Service 552
Faculti des Sciences de Saint Jirtme
13397 Marseille CEDEX 20
FRANCE
Tel: 33 (0)4 91 28 81 92
Fax : 33 (0)4 91 28 83 23
_______________________________________________
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.

  • Prev by Date: Re: Url display
  • Next by Date: Re: NSButton Colour?
  • Previous by thread: Re: Url display
  • Next by thread: CFMessagePort : no communication in 10.2 in some cases?
  • Index(es):
    • Date
    • Thread