Changeset 4250


Ignore:
Timestamp:
01/10/14 11:25:24 (10 years ago)
Author:
twagoo
Message:

comments and readability of new CMDI view toggle solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowResultPage.java

    r4249 r4250  
    503503    }
    504504
     505    private Label completeCmdiLabel = null;
     506   
    505507    /**
    506508     * Add complete CMDI view
     
    509511     */
    510512    private void addCompleteCmdiView(final SolrDocument solrDocument) {
    511 
     513        // create a container for the complete CMDI view and a toggle link (this is required for proper AJAX updates)
    512514        final MarkupContainer completeCmdiContainer = new WebMarkupContainer("completeCmdiContainer");
    513515        completeCmdiContainer.setOutputMarkupId(true);
    514516        add(completeCmdiContainer);
     517       
     518        // Add a toggle link that provides lazy execution of CMDI transformation
    515519        Link toggleLink = new IndicatingAjaxFallbackLink("toggleCmdiView") {
    516520
     
    518522            public void onClick(AjaxRequestTarget target) {
    519523                if (completeCmdiLabel == null) {
     524                    // first click: perform transformation
    520525                    createCompleteCmdiView(solrDocument);
    521526                    completeCmdiContainer.addOrReplace(completeCmdiLabel);
    522527                } else {
     528                    // subsequent click: toggle visibility of transformation output
    523529                    completeCmdiLabel.setVisible(!completeCmdiLabel.isVisible());
    524530                }
     
    526532            }
    527533        };
     534        // add a label to the toggle link that represents the visibility state of the transformation output
    528535        final Label toggleLabel = new Label("toggleLabel", new AbstractReadOnlyModel<String>() {
    529536
     
    539546        toggleLink.add(toggleLabel);
    540547        completeCmdiContainer.add(toggleLink);
    541         completeCmdiContainer.add(new WebMarkupContainer("completeCmdi"));
     548       
     549        // add a placeholder for the transformation
     550        final WebMarkupContainer completeCmdiPlaceholder = new WebMarkupContainer("completeCmdi");
     551        completeCmdiPlaceholder.setVisible(false);
     552        completeCmdiContainer.add(completeCmdiPlaceholder);
    542553    }
    543554
     
    570581        completeCmdiLabel.setEscapeModelStrings(false);
    571582    }
    572 
    573     private Label completeCmdiLabel = null;
    574583}
Note: See TracChangeset for help on using the changeset viewer.