|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| I18nMVCFinder.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 | // | |
| 2 | // Copyright (c) 2003,2004 , Caltha - Gajda, Krzewski, Mach, Potempski Sp.J. | |
| 3 | // All rights reserved. | |
| 4 | // | |
| 5 | // Redistribution and use in source and binary forms, with or without modification, | |
| 6 | // are permitted provided that the following conditions are met: | |
| 7 | // | |
| 8 | // * Redistributions of source code must retain the above copyright notice, | |
| 9 | // this list of conditions and the following disclaimer. | |
| 10 | // * Redistributions in binary form must reproduce the above copyright notice, | |
| 11 | // this list of conditions and the following disclaimer in the documentation | |
| 12 | // and/or other materials provided with the distribution. | |
| 13 | // * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J. | |
| 14 | // nor the names of its contributors may be used to endorse or promote products | |
| 15 | // derived from this software without specific prior written permission. | |
| 16 | // | |
| 17 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
| 18 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 19 | // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | // IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 21 | // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 22 | // BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | |
| 23 | // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 24 | // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 25 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | // POSSIBILITY OF SUCH DAMAGE. | |
| 27 | // | |
| 28 | package org.objectledge.web.mvc.finders; | |
| 29 | ||
| 30 | import org.jcontainer.dna.Logger; | |
| 31 | import org.objectledge.context.Context; | |
| 32 | import org.objectledge.i18n.I18n; | |
| 33 | import org.objectledge.i18n.I18nContext; | |
| 34 | import org.objectledge.templating.Templating; | |
| 35 | import org.picocontainer.MutablePicoContainer; | |
| 36 | ||
| 37 | /** | |
| 38 | * An implemention of MVCFinder that looks up localized view templates. | |
| 39 | * | |
| 40 | * @author <a href="mailto:rafal@caltha.pl">Rafal Krzewski</a> | |
| 41 | * @version $Id: I18nMVCFinder.java,v 1.2 2005/02/28 10:47:46 rafal Exp $ | |
| 42 | */ | |
| 43 | public class I18nMVCFinder | |
| 44 | extends MVCFinder | |
| 45 | { | |
| 46 | private final Context context; | |
| 47 | private final I18n i18n; | |
| 48 | ||
| 49 | /** | |
| 50 | * Creates new I18nMVCFinder instance. | |
| 51 | * | |
| 52 | * @param container the container of UI components. | |
| 53 | * @param logger the logger to use. | |
| 54 | * @param templating the Templating component. | |
| 55 | * @param nameSequenceFactory the sequence factory component. | |
| 56 | * @param context the application context. | |
| 57 | * @param i18n the I18n component. | |
| 58 | */ | |
| 59 | 0 | public I18nMVCFinder(MutablePicoContainer container, Logger logger, Templating templating, |
| 60 | NameSequenceFactory nameSequenceFactory, Context context, I18n i18n) | |
| 61 | { | |
| 62 | 0 | super(container, logger, templating, nameSequenceFactory); |
| 63 | 0 | this.context = context; |
| 64 | 0 | this.i18n = i18n; |
| 65 | } | |
| 66 | ||
| 67 | /** | |
| 68 | * {@inheritDoc} | |
| 69 | */ | |
| 70 | 0 | protected Sequence getTemplateNameSequence(Kind kind, String view, boolean fallback, |
| 71 | boolean enclosing) | |
| 72 | { | |
| 73 | 0 | Sequence viewLookupSequence = super |
| 74 | .getTemplateNameSequence(kind, view, fallback, enclosing); | |
| 75 | 0 | I18nContext i18nContext = I18nContext.getI18nContext(context); |
| 76 | 0 | return new I18nViewLookupSequence(viewLookupSequence, i18n, i18nContext); |
| 77 | } | |
| 78 | } |
|
||||||||||