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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Oliver Rettig
Hallo,

I have implemented a PrintProvider and put it into the lookup of a
MultiviewElement TopComponent but it is not used by the print-system.

I am using NB 8.2 and I have read the following pages to understand the usage
of the NB print system:

http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-print/org/netbeans/
api/print/PrintManager.html

http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-print/org/netbeans/
api/print/PrintManager.html

All seems to be straight forward. To be sure that my PrintProvider is not used
I have put an System.out in its

public PrintPage[][] getPages(int pageWidth, int pageHeight, double pageZoom)

method.

I have also tried to put the PrintProvider in the parent topcomponent of the
MultiviewElement but it isnt found.

The printprovider is a modified version of
package org.netbeans.modules.print.provider which collects all Views to print
them together as pages instead of printing only the currently active
Multiview-Element.

Andy ideas?

best regards
Oliver


Reply | Threaded
Open this post in threaded view
|

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

Neil C Smith-2
On Tue, May 9, 2017 at 5:58 PM Oliver Rettig <[hidden email]> wrote:
To be sure that my PrintProvider is not used
I have put an System.out in its

That might not prove anything?!  Try logging or (drastically) throwing an exception / assertion.

Best wishes,

Neil
--
Neil C Smith
Artist & Technologist

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Reply | Threaded
Open this post in threaded view
|

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

Oliver Rettig
Hi Neil,

thanks for your quick answer.

I throw RuntimeExceptions to be sure:-)

But it is not invoked, no exceptions are thrown.

any further ideas?

best regards
Oliver

> On Tue, May 9, 2017 at 5:58 PM Oliver Rettig <[hidden email]> wrote:
> > To be sure that my PrintProvider is not used
> > I have put an System.out in its
>
> That might not prove anything?!  Try logging or (drastically) throwing an
> exception / assertion.
>
> Best wishes,
>
> Neil


Reply | Threaded
Open this post in threaded view
|

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

Neil C Smith-2
Hi,

On Tue, May 9, 2017 at 6:23 PM Oliver Rettig <[hidden email]> 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

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org
Reply | Threaded
Open this post in threaded view
|

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

Boris Heithecker
Is the File/Print action enabled when your TopComponent is activated?
Boris

2017-05-09 19:33 GMT+02:00 Neil C Smith <[hidden email]>:
Hi,

On Tue, May 9, 2017 at 6:23 PM Oliver Rettig <[hidden email]> 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

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org



--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34
Reply | Threaded
Open this post in threaded view
|

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

Oliver Rettig
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 <[hidden email]>:
> > Hi,
> >
> > On Tue, May 9, 2017 at 6:23 PM Oliver Rettig <[hidden email]>
> >
> > 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


Reply | Threaded
Open this post in threaded view
|

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

Boris Heithecker
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 <[hidden email]>:
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 <[hidden email]>:
> > Hi,
> >
> > On Tue, May 9, 2017 at 6:23 PM Oliver Rettig <[hidden email]>
> >
> > 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





--
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Tel.: 0 42 05/ 31 58 34