net.sf.jguiraffe.resources.impl.bundle.BundleResourceGroup Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jguiraffe Show documentation
Show all versions of jguiraffe Show documentation
Java GUI Resource and Application Framework with Form Extensions
/*
* Copyright 2006-2010 The JGUIraffe Team.
*
* 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.
*/
package net.sf.jguiraffe.resources.impl.bundle;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Set;
import net.sf.jguiraffe.resources.ResourceGroup;
/**
*
* A specialized implementation of the ResourceGroup
interface that
* is backed by a java.util.ResourceBundle
.
*
*
* The methods required by the ResourceGroup
interface are
* delegated to the internally managed resource bunde. During construction this
* bundle is loaded for the specified base name and locale.
*
*
* @author Oliver Heger
* @version $Id: BundleResourceGroup.java 195 2010-08-30 19:54:41Z oheger $
*/
class BundleResourceGroup implements ResourceGroup
{
/** Stores the bundle this implementation is based on. */
private final ResourceBundle bundle;
/** Stores the name of this group. */
private final String name;
/** Stores the locale of this group. */
private final Locale locale;
/**
* Creates a new instance of BundleResourceGroup
and
* initializes it.
*
* @param name the group's name
* @param locale the locale
* @throws java.util.MissingResourceException if the bundle cannot be found
*/
public BundleResourceGroup(String name, Locale locale)
{
this.name = name;
this.locale = locale;
bundle = initBundle(name, locale);
}
/**
* Returns the bundle that is wrapped by this resource group.
*
* @return the underlying bundle
*/
public ResourceBundle getBundle()
{
return bundle;
}
/**
* Returns the name of this resource group.
*
* @return the name of this group
*/
public Object getName()
{
return name;
}
/**
* Returns a set with all keys contained in this resource group.
*
* @return a set with the defined keys
*/
public Set
© 2015 - 2024 Weber Informatics LLC | Privacy Policy