Fwd: Re: Re: PrintProvider implementation in the Lookup of a MultiviewElement TopComponent not used!

Oliver Rettig <[email protected]> Tue, 09 May 2017 22:16:10 +0200
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Organization ORAT
Message-ID <2457170.kNHHFk33On@l560>
Hi Boris,

Yes you are completely right. I have tried it out. The implementation of the 
PrintAction is different than the documentation. 

Javadoc and also several other internet resources e.g.

http://wiki.netbeans.org/BookNBPlatformCookbookCH1002

says that if a PrintProvider is in the looktup this will be used and if no 
PrintProvider is found than the default implementation is used if 
PrintManager.PRINT_PRINTABLE is set to TRUE. 

What the documentation says looks useful for me, so the question is, is the 
implementation wrong or the documentation?

For me I can WORKAROUND in my app.

Maybe the implementation is wrong. I have filled an issue:

https://netbeans.org/bugzilla/show_bug.cgi?id=270601

With my PrintProvider implementation I now run into the same issues as 
described here:

https://netbeans.org/bugzilla/show_bug.cgi?id=218394

It would be great if the the dialog can be more configurable. So I also vote 
for this. 

Thanks for your help Boris.

best regards
Oliver


> I've had a very quick look at the sources of PrintAction. The action first
> searches for components with the PrintManager.PRINT_PRINTABLE property set
> to TRUE among all child components of the activated TopComponent.
> If this happens to be the case, i.e. any component found, the lookup is not
> queried anymore. (The javadoc seems to be incorrect at PrintManger, but I
> may also be wrong.)
> Hope this helps,
> Boris
> 
> 2017-05-09 20:16 GMT+02:00 Oliver Rettig <[email protected]>:
> > Hi Boris,
> > 
> > > Is the File/Print action enabled when your TopComponent is activated?
> > 
> > yes, the actions are active, printpreview and pagesetup work fine with the
> > default behavoir which should be active without explicit adding a
> > PrintProvider in the lookup.
> > 
> > For this default behavoir the following properties are set:
> >  putClientProperty(PrintManager.PRINT_PRINTABLE, Boolean.TRUE);
> >  putClientProperty(PrintManager.PRINT_NAME, ...);
> > 
> > The strange thing is that the print actions are still available even if I
> > comment out the put with the PRINT_PRINTABLE property.
> > 
> > best regards
> > Oliver
> > 
> > > 2017-05-09 19:33 GMT+02:00 Neil C Smith <[email protected]>:
> > > > Hi,
> > > > 
> > > > On Tue, May 9, 2017 at 6:23 PM Oliver Rettig <[email protected]>
> > > > 
> > > > wrote:
> > > >> I throw RuntimeExceptions to be sure:-)
> > > >> 
> > > >> But it is not invoked, no exceptions are thrown.
> > > >> 
> > > >> any further ideas?
> > > > 
> > > > Unfortunately not from me - not made use of PrintProvider yet.  Just
> > > > checking you weren't only using System.out as a check given it's
> > 
> > usually
> > 
> > > > not visible - painful memories of early days with the platform there!
> > 
> > ;-)
> > 
> > > > Good luck with it.
> > > > 
> > > > Best wishes,
> > > > 
> > > > Neil
> > > > --
> > > > Neil C Smith
> > > > Artist & Technologist
> > > > www.neilcsmith.net
> > > > 
> > > > Praxis LIVE - hybrid visual IDE for creative coding -
> > 
> > www.praxislive.org


-------------------------------------------------------------