001: /*
002: * @(#) $Header: /cvs/jai-operators/src/main/ca/forklabs/media/jai/Resources.java,v 1.2 2007/06/11 22:11:32 forklabs Exp $
003: *
004: * Copyright (C) 2007 Daniel Léonard
005: *
006: * This program is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU General Public License
008: * as published by the Free Software Foundation; either version 2
009: * of the License, or (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
019: */
020:
021: package ca.forklabs.media.jai;
022:
023: import java.text.MessageFormat;
024: import java.util.ResourceBundle;
025:
026: /**
027: * Class {@code Resources} is the default bundle for the resources used by
028: * classes in the {@link ca.forklabs.media.jai} package.
029: *
030: * @author <a href="mailto:forklabs at dev.java.net?subject=ca.forklabs.media.jai.Resources">Daniel Léonard</a>
031: * @version $Revision: 1.2 $
032: */
033: @SuppressWarnings("nls")
034: class Resources {
035:
036: //---------------------------
037: // Class variables
038: //---------------------------
039:
040: /** The key for a bad tile request. */
041: public static final String RASTER_ADAPTER_BAD_TILE = "raster.adapter.bad.tile";
042:
043: /** Key for the error message saying the mode should have been a collection mode. */
044: public static final String NEITHER_COLLECTION_NOR_RENDERABLE_COLLECTION_MODE = "neither.collection.nor.renderable.collection.mode";
045: /** Key for the error message saying the not all the sources are rendered images. */
046: public static final String NOT_ALL_RENDERED_IMAGE = "not.all.rendered.image";
047: /** Key for the error message saying the not all the sources are renderable images. */
048: public static final String NOT_ALL_RENDERABLE_IMAGE = "not.all.renderable.image";
049: /** Key for the error message saying the operator does not have any enumerated parameters. */
050: public static final String NO_ENUMERATED_PARAMETERS = "no.enumerated.parameters";
051: /** Key for the error message saying that the parameter is unknown. */
052: public static final String UNKNOWN_PARAMETER = "unknown.parameter";
053:
054: //---------------------------
055: // Constructor
056: //---------------------------
057:
058: /**
059: * Let no one instanciate this class.
060: */
061: private Resources() {
062: // nothing
063: }
064:
065: //---------------------------
066: // Class method
067: //---------------------------
068:
069: /**
070: * Gets the resource bundle itself.
071: * @return the resource bundle.
072: */
073: public static ResourceBundle getResourceBundle() {
074: String name = Resources.class.getName();
075: ResourceBundle bundle = ResourceBundle.getBundle(name);
076: return bundle;
077: }
078:
079: /**
080: * Gets and formats the specified localized string from the menu resource
081: * bundle.
082: * @param key the key.
083: * @param arguments the arguments to format the string.
084: * @return the value.
085: */
086: public static String getLocalizedString(String key,
087: Object... arguments) {
088: ResourceBundle bundle = Resources.getResourceBundle();
089: String pattern = bundle.getString(key);
090: String message = MessageFormat.format(pattern, arguments);
091: return message;
092: }
093:
094: }
095:
096: /*
097: * $Log: Resources.java,v $
098: * Revision 1.2 2007/06/11 22:11:32 forklabs
099: * A class to help descriptors in collection and renderable collection mode.
100: *
101: * Revision 1.1 2007/05/03 18:31:28 forklabs
102: * Intial commit for RasterAdapter.
103: *
104: */
|