Changeset 4226


Ignore:
Timestamp:
01/08/14 11:07:48 (10 years ago)
Author:
twagoo
Message:

enabled custom request cycle. fixed an issue in html page

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  
    1313import org.apache.wicket.request.Request;
    1414import org.apache.wicket.request.Response;
     15import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
    1516import org.apache.wicket.request.cycle.RequestCycle;
    16 import org.apache.wicket.request.cycle.RequestCycleContext;
    1717import org.apache.wicket.util.string.StringValue;
    1818
    1919/**
    2020 * Virtual Language Observatory web application<br><br>
    21  * 
     21 *
    2222 * <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,
    2525 * running the Start class enables you to run it without outside one.
    2626 */
    2727public class VloWebApplication extends WebApplication {
    28    
     28
    2929    /**
    3030     * Customised client request cycle<br><br>
    31      * 
     31     *
    3232     * <intercept resquest in order to update session parameter list>
    33      * 
     33     *
    3434     * Add behaviour to the web request handling by retrieving persistent
    35      * parameters to the application from from client requests, and store
    36      * the in the application object.
     35     * parameters to the application from from client requests, and store the in
     36     * the application object.
    3737     */
    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 {
    4439
    45         /**
    46          * Add the behaviour to the beginning of the processing of a request
    47          */
    4840        @Override
    49         public void onBeginRequest() {
     41        public void onBeginRequest(RequestCycle cycle) {
    5042            // first, invoke the default behavior
    51             super.onBeginRequest();
     43            super.onBeginRequest(cycle);
    5244            // after that, get the parameters of the request itself
    53             IRequestParameters reqParam = getRequest().getRequestParameters();
    54            
     45            IRequestParameters reqParam = cycle.getRequest().getRequestParameters();
     46
    5547            // from these, get the parameters represented in the URL
    5648            //Map <String, String[]> map = this.getWebRequest().getParameterMap();
    57             // check if there is a theme parameter       
     49            // check if there is a theme parameter
    5850            StringValue object = reqParam.getParameterValue("theme");
    59                        
     51
    6052            if (object.isEmpty()) {
    6153                // no theme choosen, keep the current one
    6254            } 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)) {
    6557                    // current theme requested, nothing to do
    6658                } else {
    6759                    // different theme requested, compose it
    68                     ((VloSession)Session.get()).setCurrentTheme(new Theme (object.toString()));
     60                    ((VloSession) Session.get()).setCurrentTheme(new Theme(object.toString()));
    6961                    // 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);
    7163                }
    7264            }
    7365        }
    7466    }
    75        
     67
    7668    /**
    7769     * Flag indicating whether or not the application object lives in a web
     
    8577    @Override
    8678    public void init() {
    87                
     79
    8880        if (inContext) {
    89            
     81
    9082            /*
    9183             * send messages to objects that need a static reference to this web
     
    9688            BasePage.setWebApp(this);
    9789            BasePanel.setWebApp(this);
    98            
     90
    9991            // install theme -> compose theme
    100 
    10192            // get the servlet's context
    102 
    10393            ServletContext servletContext;
    10494            servletContext = this.getServletContext();
    105            
     95
    10696            /*
    10797             * Send the application context to the configuration object to
     
    10999             * configuration file.
    110100             */
    111            
    112101            VloContextConfig.switchToExternalConfig(servletContext);
     102
     103            getRequestCycleListeners().add(new CustomRequestCycleListener());
    113104        }
    114105
    115106        // creata an object referring to the search results
    116         searchResults = new SearchResultsDao();       
     107        searchResults = new SearchResultsDao();
    117108
    118109        // hand over control to the application
    119110    }
    120    
     111
    121112    // remember the search results
    122113    private SearchResultsDao searchResults;
    123    
     114
    124115    /**
    125116     * Web application constructor<br><br>
     
    138129         * init()} method will be invoked.
    139130         */
    140        
    141131        VloConfig.readPackagedConfig();
    142132
    143133        // let the {@literal init()} method know that there will be a context
    144 
    145         inContext = true; 
     134        inContext = true;
    146135    }
    147136
     
    155144     * the application's tests will send false to the application constructor.
    156145     * <br><br>
    157      * 
     146     *
    158147     * @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
    160149     * context so that, if it is defined in it, an external configuration can be
    161      * switched to. 
     150     * switched to.
    162151     */
    163152    public VloWebApplication(Boolean inContext) {
    164153
    165154        // remember that the application does not live in a web server context
    166        
    167155        this.inContext = inContext;
    168        
     156
    169157        searchResults = new SearchResultsDao();
    170158    }
     
    186174        return new VloSession(request);
    187175    }
    188    
    189    
     176
    190177}
  • vlo/branches/to-wicket-1.6/vlo_web_app/src/main/java/eu/clarin/cmdi/vlo/pages/ShowAllFacetValuesPage.html

    r2768 r4226  
    44    <wicket:extend>
    55        <div class="categorylist">
    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>
     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>
    2020            <div wicket:id="alphaPanel"></div>
    2121        </div>
Note: See TracChangeset for help on using the changeset viewer.