/*
 * $Id: ResourceInfo.java,v 1.4 2004/08/21 17:01:55 koppy Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 *
 * $Log: ResourceInfo.java,v $
 * Revision 1.4  2004/08/21 17:01:55  koppy
 * + getMessage( key, stringLength)
 *
 * Revision 1.3  2004/08/20 12:58:56  koppy
 * Erweitert um getMessage(.., arg0, arg1...)
 *
 * Revision 1.2  2004/07/20 08:51:21  jonyp
 * added copyright info + cvs log
 *
 *
 */

package vkc.view.bean;

import java.util.Locale;

import org.apache.struts.util.MessageResources;

import vkc.util.StringUtils;

public final class ResourceInfo {
	private Locale locale;
	private MessageResources resource;

	public ResourceInfo() {
	}

	public ResourceInfo( MessageResources r, Locale l ) {
		resource = r;
		locale = l;
	}

	public MessageResources getResource() {
		return resource;
	}

	public Locale getLocale() {
		return locale;
	}

	public void setResource( MessageResources resources ) {
		resource = resources;
	}

	public void setLocale( Locale l ) {
		locale = l;
	}
	
	public String getMessage( String key ) {
		return getResource().getMessage( getLocale(), key );
	}
	
	public String getMessage( String key, int stringLength ) {
		return this.getMessage( key, "", stringLength);
	}
	
	public String getMessage( String key, String suffix, int stringLength ) {
		return StringUtils.fillUp(
		        getResource().getMessage( getLocale(), key ) + suffix, ' ', stringLength);
	}
	
	public String getMessage( String key, Object arg0 ) {
		return getResource().getMessage( getLocale(), key, arg0 );
	}
	
	public String getMessage( String key, Object arg0, Object arg1 ) {
		return getResource().getMessage( getLocale(), key, arg0, arg1 );
	}
	
	public String getMessage( String key, Object arg0, Object arg1, Object arg2 ) {
		return getResource().getMessage( getLocale(), key, arg0, arg1, arg2 );
	}
	
}