001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.loader; 029 030import org.opencms.i18n.I_CmsMessageContainer; 031 032import java.util.HashMap; 033import java.util.Locale; 034import java.util.Map; 035 036/** 037 * Bean that represents a client variant of a template context.<p> 038 */ 039public class CmsClientVariant { 040 041 /** The nice name of the variant. */ 042 private I_CmsMessageContainer m_message; 043 044 /** The internal name of the client variant. */ 045 private String m_name; 046 047 /** An additional map of parameters for the variant. */ 048 private Map<String, String> m_parameters; 049 050 /** The screen height. */ 051 private int m_screenHeight; 052 053 /** The screen width. */ 054 private int m_screenWidth; 055 056 /** 057 * Creates a new instance.<p> 058 * 059 * @param name the internal name of the client variant 060 * @param message the nice name of the variant 061 * @param width the screen width 062 * @param height the screen height 063 * @param parameters parameters for the variant 064 */ 065 public CmsClientVariant( 066 String name, 067 I_CmsMessageContainer message, 068 int width, 069 int height, 070 Map<String, String> parameters) { 071 072 m_name = name; 073 m_screenWidth = width; 074 m_screenHeight = height; 075 m_message = message; 076 m_parameters = new HashMap<String, String>(parameters); 077 } 078 079 /** 080 * Gets the internal name.<p> 081 * 082 * @return the name 083 */ 084 public String getName() { 085 086 return m_name; 087 } 088 089 /** 090 * Gets the nice name for a locale.<p> 091 * 092 * @param locale the locale 093 * 094 * @return the nice name 095 */ 096 public String getNiceName(Locale locale) { 097 098 return m_message.key(locale); 099 } 100 101 /** 102 * Gets the parameters.<p> 103 * 104 * @return the parameters 105 */ 106 public Map<String, String> getParameters() { 107 108 return m_parameters; 109 } 110 111 /** 112 * Gets the screen height.<p> 113 * 114 * @return the screen height 115 */ 116 public int getScreenHeight() { 117 118 return m_screenHeight; 119 } 120 121 /** 122 * Gets the screen width.<p> 123 * 124 * @return the screen width 125 */ 126 public int getScreenWidth() { 127 128 return m_screenWidth; 129 } 130}