View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   package org.directdemocracyportal.democracy.web;
6   
7   import org.springframework.context.ApplicationContext;
8   import org.springframework.context.MessageSource;
9   import org.springframework.context.support.ResourceBundleMessageSource;
10  
11  import thinwire.ui.event.ActionListener;
12  
13  /***
14   * The Class BeanLocator.
15   */
16  public class BeanLocator
17  {
18  
19      /***
20       * Gets the application context.
21       *
22       * @return the application context
23       */
24      private static ApplicationContext getApplicationContext() {
25          return StaticContextLoaderListener.getWebApplicationContext();
26      }
27  
28      /***
29       * Gets the resource bundle message source.
30       *
31       * @return the resource bundle message source
32       */
33      public static MessageSource getResourceBundleMessageSource() {
34          return (ResourceBundleMessageSource) getApplicationContext().getBean(
35                  "messageSource");
36      }
37  
38      /***
39       * Gets the application action listener.
40       *
41       * @return the application action listener
42       */
43      public static ActionListener getApplicationActionListener() {
44          return (ActionListener) getApplicationContext().getBean(
45                  "applicationActionListener");
46      }
47  }