> S. Isaac Dealey wrote:
>> and format(long)... So I've tried using both
>> object.format(javacast("double",number)) and
>> object.format(javacast("long",number)) and in both cases
>> an error is
>> produced saying "The selected method format was not
>> found." ... and if
>> I dump the java object it shows two instance of the
>> format() function
>> in the dump results... what gives?!

> yup numberformat is one of the few java classes (there are
> others) that
> cf just won't talk to. somebody who knew java way better
> than i
> explained it to me once but i've more or less forgotten
> the real details
> but i recall something about the type of Number/number cf
> produces. you
> will need to use a wrapper class.

> btw why aren't you using the numberformat wrapper class
> included w/our
> i18n stuff? you didn't think we added that to show off our
> "mad" java
> skills did you ;-)

Well I'm always hopeful. :P Trying to create something that can
_potentially_ scale back to CF5 without changing the implementation
code for an application and never wanting to require someone to have
access to the WEB-INF directory so that it supports shared-hosting.
I'll probably use something for numberformatting that's similar to my
parse-date function which allows a custom function to override the
default java implementation if present, so that a developer could
easily swap out their own implementation of number formatting for any
given locale or for all locales application-wide simply by creating
the appropriately named function.

The parse-date function looks like this:

function lsdateparse(datestring) {
  var locale = request.tapi.jLocale(request.tapi.arg(arguments,2,""));
  var jformat = false; var jnfield = false;
  var fnformat = request.tapi.ls("%tap_fnDateParse");
  datestring = trim(datestring);

  if (iscustomfunction(fnformat)) { return
fnformat(datestring,locale); }

  if (not isdefined("request.tapi.lsdateobject")) {
    request.tapi.lsdateobject =
createObject("java","java.text.DateFormat");
  } jformat = request.tapi.lsdateobject;
  jformat = jformat.getDateInstance(3,locale);
  return jformat.parse(javacast("string",datestring));
}

I haven't released this yet, I'm still testing it. "fnformat" checks
for a localized variable which is then substituted for the remainder
of this function if it's a custom function.
"request.tapi.lsdateobject" is cached in the application scope
(request.tapi is a pointer on mx) so that the dateformat object is
only instantiated once -- I'm guessing I'll probably need to modify
that so that it caches a separate instance for each locale. I noticed
I needed to cache one object for each locale with the util.Locale
objects.

s. isaac dealey     954.927.5117
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://macromedia.breezecentral.com/p49777853/
http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191052
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to