Re: BasicSSCell.removeAllReferences()

Hi Mathias,

If you simply need to remove the references from the BasicSSCell's
display, you can do:

// save reference list
DataReferenceImpl[] refs = cell.getReferences();
// temporarily remove references
DisplayImpl display = cell.getDisplay();
display.removeAllReferences();
// do some stuff
......
// re-add references
for (int i=0; i<refs.length; i++) display.addReference(refs[i]);

Alternatively, if you really need to remove the references from the
BasicSSCell itself, you could try doing getData() on each of the
references first, then doing setData() later.  If that causes problems,
let me know and I'll look into the issue further.

-Curtis

At 11:47 AM 8/8/01 +0200, you wrote:
>Hi,
> 
>First, thanks Bill for your help. It worked for me the way you told me.
> 
>This time I have a problem with the removeAllReferences()-method of 
>BasicSSCell. I want to temporarily remove all DataReferenceImpls from my 
>BasicSSCell. Therefore I save them with:
> 
>DataReferenceImpl[] refs = cell.getReferences();
> 
>And remove them from the cell with:
> 
>cell.removeAllReferences();
> 
>But when I want to re-add the References to the cell with:
> 
>for (int i = 0 ; i < refs.length ; i++) cell.addReference();
> 
>I recognize that the References have no data linked. So it seems to me like 
>removeAllReferences() clears all the Data-objects of the DataReferences. I 
>checked this with the following piece of code:
> 
>DataReferenceImpl[] refs = cell.getReferences();
>System.out.println(refs[0]);
>System.out.println(refs[0].getData);
>cell.removeAllReferences();
>System.out.println(refs[0]);
>System.out.println(refs[0].getData);
> 
>The output is:
> 
>DataReference cell0
>FlatField........
>DataReference cell0
>null
> 
>Is there a possibility to prevent this issue? I looked into the code of 
>BasicSSCell and found that removeDataImpl(...) is responsible for this. But I 
>found this method also in remoevReference(...) and removeData(...). So is 
>there any possibility to remove data from the cell without destroying it?
> 
>Thanks in advance, Mathias


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