Changeset 4226
- Timestamp:
- 01/08/14 11:07:48 (10 years ago)
- Location:
- vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/VloWebApplication.java
r4220 r4226 13 13 import org.apache.wicket.request.Request; 14 14 import org.apache.wicket.request.Response; 15 import org.apache.wicket.request.cycle.AbstractRequestCycleListener; 15 16 import org.apache.wicket.request.cycle.RequestCycle; 16 import org.apache.wicket.request.cycle.RequestCycleContext;17 17 import org.apache.wicket.util.string.StringValue; 18 18 19 19 /** 20 20 * Virtual Language Observatory web application<br><br> 21 * 21 * 22 22 * <describe VLO> 23 * 24 * While the application is intended to run inside a web server container, 23 * 24 * While the application is intended to run inside a web server container, 25 25 * running the Start class enables you to run it without outside one. 26 26 */ 27 27 public class VloWebApplication extends WebApplication { 28 28 29 29 /** 30 30 * Customised client request cycle<br><br> 31 * 31 * 32 32 * <intercept resquest in order to update session parameter list> 33 * 33 * 34 34 * Add behaviour to the web request handling by retrieving persistent 35 * parameters to the application from from client requests, and store 36 * the in theapplication object.35 * parameters to the application from from client requests, and store the in 36 * the application object. 37 37 */ 38 private class CustomCycle extends RequestCycle { 39 40 // find out why this is necessary 41 CustomCycle (RequestCycleContext context){ 42 super(context); 43 } 38 private class CustomRequestCycleListener extends AbstractRequestCycleListener { 44 39 45 /**46 * Add the behaviour to the beginning of the processing of a request47 */48 40 @Override 49 public void onBeginRequest( ) {41 public void onBeginRequest(RequestCycle cycle) { 50 42 // first, invoke the default behavior 51 super.onBeginRequest( );43 super.onBeginRequest(cycle); 52 44 // after that, get the parameters of the request itself 53 IRequestParameters reqParam = getRequest().getRequestParameters();54 45 IRequestParameters reqParam = cycle.getRequest().getRequestParameters(); 46 55 47 // from these, get the parameters represented in the URL 56 48 //Map <String, String[]> map = this.getWebRequest().getParameterMap(); 57 // check if there is a theme parameter 49 // check if there is a theme parameter 58 50 StringValue object = reqParam.getParameterValue("theme"); 59 51 60 52 if (object.isEmpty()) { 61 53 // no theme choosen, keep the current one 62 54 } else { 63 // check if the users requests a different theme 64 if (object.toString().matches(((VloSession) Session.get()).getCurrentTheme().name)) {55 // check if the users requests a different theme 56 if (object.toString().matches(((VloSession) Session.get()).getCurrentTheme().name)) { 65 57 // current theme requested, nothing to do 66 58 } else { 67 59 // different theme requested, compose it 68 ((VloSession) Session.get()).setCurrentTheme(new Theme(object.toString()));60 ((VloSession) Session.get()).setCurrentTheme(new Theme(object.toString())); 69 61 // remember the theme as a vlo session page parameter 70 ((VloSession) Session.get()).vloSessionPageParameters.add("theme", object);62 ((VloSession) Session.get()).vloSessionPageParameters.add("theme", object); 71 63 } 72 64 } 73 65 } 74 66 } 75 67 76 68 /** 77 69 * Flag indicating whether or not the application object lives in a web … … 85 77 @Override 86 78 public void init() { 87 79 88 80 if (inContext) { 89 81 90 82 /* 91 83 * send messages to objects that need a static reference to this web … … 96 88 BasePage.setWebApp(this); 97 89 BasePanel.setWebApp(this); 98 90 99 91 // install theme -> compose theme 100 101 92 // get the servlet's context 102 103 93 ServletContext servletContext; 104 94 servletContext = this.getServletContext(); 105 95 106 96 /* 107 97 * Send the application context to the configuration object to … … 109 99 * configuration file. 110 100 */ 111 112 101 VloContextConfig.switchToExternalConfig(servletContext); 102 103 getRequestCycleListeners().add(new CustomRequestCycleListener()); 113 104 } 114 105 115 106 // creata an object referring to the search results 116 searchResults = new SearchResultsDao(); 107 searchResults = new SearchResultsDao(); 117 108 118 109 // hand over control to the application 119 110 } 120 111 121 112 // remember the search results 122 113 private SearchResultsDao searchResults; 123 114 124 115 /** 125 116 * Web application constructor<br><br> … … 138 129 * init()} method will be invoked. 139 130 */ 140 141 131 VloConfig.readPackagedConfig(); 142 132 143 133 // let the {@literal init()} method know that there will be a context 144 145 inContext = true; 134 inContext = true; 146 135 } 147 136 … … 155 144 * the application's tests will send false to the application constructor. 156 145 * <br><br> 157 * 146 * 158 147 * @param inContext If and only if this parameter equals true. later on, the 159 * {@literal init} method will try to determine the web server's container 148 * {@literal init} method will try to determine the web server's container 160 149 * context so that, if it is defined in it, an external configuration can be 161 * switched to. 150 * switched to. 162 151 */ 163 152 public VloWebApplication(Boolean inContext) { 164 153 165 154 // remember that the application does not live in a web server context 166 167 155 this.inContext = inContext; 168 156 169 157 searchResults = new SearchResultsDao(); 170 158 } … … 186 174 return new VloSession(request); 187 175 } 188 189 176 190 177 } -
vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowAllFacetValuesPage.html
r2768 r4226 4 4 <wicket:extend> 5 5 <div class="categorylist"> 6 <div style="text-indent:10px; >7 8 9 10 11 12 13 14 15 16 17 18 19 6 <div style="text-indent:10px;"> 7 <table> 8 <tr> 9 <td width="50%" class="column"> 10 <div wicket:id="filteredFacets"><span wicket:id="filteredFacet"/></div> 11 </td> 12 </tr> 13 </table> 14 <div class="filter"> 15 <a href="#" wicket:id="filter"><span wicket:id="filterLabel">Filter</span></a> 16 </div> 17 <br> 18 <div class="message"><wicket:message key="subcategoriesIn">[Subcategories]</wicket:message> <span class="facet" wicket:id="category"></span>:</div> 19 </div> 20 20 <div wicket:id="alphaPanel"></div> 21 21 </div>
Note: See TracChangeset
for help on using the changeset viewer.