• 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
NSFormatter Java .jobs Missing?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFormatter Java .jobs Missing?


  • Subject: NSFormatter Java .jobs Missing?
  • From: Jim Riggs <email@hidden>
  • Date: Sun, 25 Aug 2002 21:46:05 -0500

Try this in Java (same results in 10.2 and Jaguar, and on different boxes)....

Subclass NSFormatter (basically, this just limits length to 8 for illustration):


public class MyFormatter extends NSFormatter {
public MyFormatter() {
super();
}

public boolean isPartialStringValid(String inString) {
return (inString.length() <= 8);
}

public Object objectValueForString(String inString) {
return inString;
}

public String stringForObjectValue(Object inObject) {
return ((inObject.getClass() != String.class)
? null
: (String) inObject);
}

public NSAttributedString attributedStringForObjectValue(
Object inObject, NSDictionary inDictionary) {
return new NSAttributedString(stringForObjectValue(inObject));
}
} // MyFormatter


Attach this to an NSTextField and test it. Every key pressed results in the following message in the Run tab of PB:

2002-08-25 21:13:10.524 Project[5646] _NSInvokeJavaMethod: java class MyFormatter doesn't implement isPartialStringValid:proposedSelectedRange:originalString:originalSelect edRange:errorDescription:, mapped to isPartialStringValid()

Likewise, when you switch to a different field and objectValueForString should be called, the following message appears:

2002-08-25 21:24:54.179 Project[5673] *** -getObjectValue:forString:errorDescription: only defined for abstract class. Define -[RegExpFormatter getObjectValue:forString:errorDescription:]!

If you add a definition for getObjectValue:

public Object getObjectValue(String inString) {
return inString;
}

...you get this when exiting the field:

2002-08-25 21:29:38.738 Project[5721] _NSInvokeJavaMethod: java class MyFormatter doesn't implement getObjectValue:forString:errorDescription:, mapped to getObjectValue()

It appears the correct mappings are missing in the Foundation .jobs mapping and the bridge is using its default behavior, mapping the selector up to the first colon. Does anyone (Apple folk, maybe) have any more information on this?

- Jim
_______________________________________________
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: keyEventWithType
  • Next by Date: Re: where are the faster compilations?
  • Previous by thread: Re: Odd sheet behavior
  • Next by thread: Re: [tableView deselectAll:nil] - is this a good way to deselect a tableView?
  • Index(es):
    • Date
    • Thread