Changeset 5019
- Timestamp:
- 04/22/14 13:37:48 (10 years ago)
- 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 31 31 import org.apache.wicket.spring.injection.annot.SpringBean; 32 32 import org.apache.wicket.util.string.StringValue; 33 import org.slf4j.Logger; 34 import org.slf4j.LoggerFactory; 33 35 34 36 /** 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> 35 47 * 36 48 * @author twagoo 49 * @param <T> the type of the page's model object (see {@link GenericWebPage}) 37 50 */ 38 51 public class VloBasePage<T> extends GenericWebPage<T> { 52 53 private final static Logger logger = LoggerFactory.getLogger(VloBasePage.class); 39 54 40 55 @SpringBean … … 56 71 } 57 72 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 */ 58 81 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"); 62 87 Session.get().setStyle(null); 63 88 } 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); 65 93 } 66 94 } … … 81 109 } 82 110 83 84 111 }
Note: See TracChangeset
for help on using the changeset viewer.