New reply on DataCleaner's online discussion forum 
(https://datacleaner.org/forum):

Guy replied to subject 'Results missing when exporting to HTML'

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

Hi Dennis,

Thanks for all your help. I was able to get the export working the way I wanted 
and match the functionality of my ResultRenderer. The code needs some cleaning 
up but its working and that's all I care about for now.

The render function in my HtmlRenderer ended up looking like this:

{{{
public HtmlFragment render(final CDWTableAnalyzerResult result) {       
        final Crosstab<Number> tableCrosstab = result.getTableCrosstab();
        final Crosstab<Number> phiCrosstab = result.getPHICrosstab();
        
        final CrosstabHtmlFragment tableFragment = tableCrosstab != null? new 
CrosstabHtmlFragment(tableCrosstab, rendererFactory) : null;
        final CrosstabHtmlFragment phiFragment = phiCrosstab != null? new 
CrosstabHtmlFragment(phiCrosstab, rendererFactory) : null;
        
        HtmlFragment finalCrosstab = new HtmlFragment() {
            @Override
            public void initialize(final HtmlRenderingContext context) {
                if(tableFragment != null){
                        tableFragment.initialize(context);
                }
                if(phiFragment != null){
                        phiFragment.initialize(context);
                }
            }

            @Override
            public List<HeadElement> getHeadElements() {
                List<HeadElement> headElements = new ArrayList<>();
                
                if(tableFragment != null){
                        headElements.addAll(tableFragment.getHeadElements());
                }
                
                if(phiFragment != null){
                        headElements.addAll(phiFragment.getHeadElements());
                }
                
                return headElements;
            }

            @Override
            public List<BodyElement> getBodyElements() {
                List<BodyElement> bodyElements = new ArrayList<>();
                
                if(tableFragment != null){
                        bodyElements.add(new SimpleBodyElement("<p 
style='font-size:18px'><b>Table Analyzer:</b></p>"));
                        bodyElements.addAll(tableFragment.getBodyElements());
                }
                
                if(tableFragment != null && phiFragment != null){
                        bodyElements.add(new SimpleBodyElement("<br/><br/>"));
                }
                
                if(phiFragment != null){
                        bodyElements.add(new SimpleBodyElement("<p 
style='font-size:18px'><b>PHI Searcher:</b></p>"));
                        bodyElements.addAll(phiFragment.getBodyElements());
                }
                
                return bodyElements;
            }
        };
        
        return finalCrosstab;
    }
}}}

Thanks again for all your help!

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

View the topic online to reply - go to 
https://datacleaner.org/topic/1155/Results-missing-when-exporting-to-HTML

-- 
You received this message because you are subscribed to the Google Groups 
"DataCleaner-notify" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/datacleaner-notify.
For more options, visit https://groups.google.com/d/optout.

Reply via email to