Changeset 5019


Ignore:
Timestamp:
04/22/14 13:37:48 (10 years ago)
Author:
Twan Goosen
Message:

documentation in VLO base page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/VloBasePage.java

    r5017 r5019  
    3131import org.apache.wicket.spring.injection.annot.SpringBean;
    3232import org.apache.wicket.util.string.StringValue;
     33import org.slf4j.Logger;
     34import org.slf4j.LoggerFactory;
    3335
    3436/**
     37 * Base page for all VLO pages; has common header and footer markup and takes
     38 * care of the following:
     39 *
     40 * <ul>
     41 * <li>setting the theme if provided in query parameters;</li>
     42 * <li>including CSS</li>
     43 * <li>adding a {@link FeedbackPanel} for info/warning/error messages</li>
     44 * <li>hiding all JavaScript fallback controls (see
     45 * {@link HideJavascriptFallbackControlsBehavior});</li>
     46 * </ul>
    3547 *
    3648 * @author twagoo
     49 * @param <T> the type of the page's model object (see {@link GenericWebPage})
    3750 */
    3851public class VloBasePage<T> extends GenericWebPage<T> {
     52
     53    private final static Logger logger = LoggerFactory.getLogger(VloBasePage.class);
    3954
    4055    @SpringBean
     
    5671    }
    5772
     73    /**
     74     * Sets the theme from the page parameters if applicable. An present but
     75     * empty theme value will reset the theme (by unsetting the style).
     76     *
     77     * @param parameters page parameters to process
     78     * @see VloWebAppParameters#THEME
     79     * @see Session#setStyle(java.lang.String)
     80     */
    5881    private void processTheme(PageParameters parameters) {
    59         final StringValue theme = parameters.get(VloWebAppParameters.THEME);
    60         if (!theme.isNull()) {
    61             if (theme.isEmpty()) {
     82        final StringValue themeValue = parameters.get(VloWebAppParameters.THEME);
     83        if (!themeValue.isNull()) {
     84            if (themeValue.isEmpty()) {
     85                // empty string resets theme
     86                logger.debug("Resetting theme");
    6287                Session.get().setStyle(null);
    6388            } else {
    64                 Session.get().setStyle(theme.toString().toLowerCase());
     89                // theme found, set it as style in the session
     90                final String theme = themeValue.toString().toLowerCase();
     91                logger.debug("Setting theme to {}", theme);
     92                Session.get().setStyle(theme);
    6593            }
    6694        }
     
    81109    }
    82110
    83 
    84111}
Note: See TracChangeset for help on using the changeset viewer.