Re: printing

Hi John,

> I am writing a SpreadSheet application and I would like to implement
> printing in my application in such a way that the background is set to
> white and the foreground is set to black.  i'd rather the user didn't
> have to see the cell flash colors when this happens, and not have to
> worry about timing issues, so the way i'd like to do this would be to
> print a clone of the current cell.  unfortunately, SSCells don't
> implement clone().  what's my best bet for achieving this end?

I think the best you'll be able to do is as follows:

1. Construct an off-screen display (there are DisplayImplJ2D
and DisplayImplJ3D constructors for this) of the same type
as your original display.

2. Call the original display's getMapVector() method and add
clones of all the ScalarMaps to the new display.

3. Call the original display's getRendererVector() method,
invoke the getLinks() method of each DataRenderer, and invoke
the getDataReference() of each DataDisplayLink, then
addReference() all these DataReferences to the new display.
See a little sample code at:

  http://www.unidata.ucar.edu/glimpse/visad-list/2152

for traversing this information.

4. Get the DisplayRenderer of the new display and call its
setBackgroundColor() and setForegroundColor() methods.

5. Now you can print the new display.

If you use ConstantMaps in your SpreadSheet application,
you may need to clone these into your new display too.

Good luck,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: