"un"extend FileDownloader and BrowserWindowOpener?

Hi,

I have a StreamResource which I’m adding into a new BrowserWindowOpener and FileDownloader to be able to download and view the resource.

Is there any way that I can perhaps “un” extend the button? Because in some cases the buttons will go disabled but clicking on them still downloads and views the resource.

    if (selectedItem != null)
    {
        StreamSource s = new StreamSource()
        {
            @Override
            public InputStream getStream()
            {
                try
                {
                    return new GZIPInputStream(new ByteArrayInputStream(/*some byte[]*/));
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
                return null;
            }
        };
        
        StreamResource r = new StreamResource(s, "some description");
        
        BrowserWindowOpener opener = new BrowserWindowOpener(r);
        opener.extend(getActionButton());
        
        FileDownloader download = new FileDownloader(r);
        download.extend(getDownloadButton());
    }

Any help would be appreciated. :slight_smile:

Use Extension.remove();
so e.g.:
download.remove();

Ah thank you very much!