Salut,
Jordi.
Oliver Rossmueller wrote:
Ooops! Ok, so here is the missing file. This class is there in preparation of future enhancements but is not really used at the moment because there is only one resouce bundle which is handled by JMeterUtils. Feel free to move the class to whatever place looks suitable for you but please let me know so I can do the same in my repository. The alternative is to remove or comment out the Resource-related lines in PluginManager, this will have no effect on functionality at the moment.
Oliver
Jordi Salvat i Alabart wrote:
I've been reviewing this. Looks really great, but there's a missing
file: Resources.java (which, BTW, I see you've placed straight under
org.jakarta.jmeter -- wouldn't it make sense to put it in org.jakarta.util?)
Can you send this file so I can go on and commit your changes?
Thanks,
Jordi.
Oliver Rossmueller wrote:
This patch contains:
- three new icons for config/sampler/listener elements
- icon mapping in the source
- begin of the implementation of a plugin mechanism (in the future I would like to register available elements via plugins to avoid searching the complete classpath for gui classes at startup)
- NamePanel responds to LocaleChangeEvent
- the tree is updated correctly when the name of an element is changed (therefore the guis got a new method setNode so that they have their corresponding tree node to propagate changes to the tree (via nameChanged of JMeterTreeNode)
The patch is available for download at
http://www.tuxerra.com/jmeter_patches/patch2.tgz.
Oliver
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
------------------------------------------------------------------------ package org.apache.jmeter; import java.util.*; public class Resources { private static final Map bundles = new HashMap(); private static final Map effectiveBundles = new HashMap(); public static void registerBundle(String bundleName, String resources, ClassLoader classLoader) { bundles.put(bundleName, new ResourceBundleSpec(resources, classLoader)); effectiveBundles.clear(); } public static ResourceBundle getBundle(Locale locale) { ResourceBundle answer = (ResourceBundle)effectiveBundles.get(locale); if (answer == null) { answer = createEffectiveBundle(locale); effectiveBundles.put(locale, answer); } return answer; } public static String getString(String key, Locale locale) { if (key == null) { return null; } return getBundle(locale).getString(key); } private static ResourceBundle createEffectiveBundle(Locale locale) { Map resources = new HashMap(); Iterator iterator = bundles.values().iterator(); while (iterator.hasNext()) { ResourceBundleSpec spec = (ResourceBundleSpec)iterator.next(); ResourceBundle bundle = spec.getBundle(locale); Enumeration enum = bundle.getKeys(); while (enum.hasMoreElements()) { String key = (String)enum.nextElement(); resources.put(key, bundle.getString(key)); } } return new EffectiveResourceBundle(resources); } private static class ResourceBundleSpec { private String resources; private ClassLoader classLoader; public ResourceBundleSpec(String resouces, ClassLoader classLoader) { this.resources = resouces; this.classLoader = classLoader; } public ResourceBundle getBundle(Locale locale) { return ResourceBundle.getBundle(resources, locale, classLoader); } } public static class EffectiveResourceBundle extends ResourceBundle { private Map resources; public EffectiveResourceBundle(Map resources) { this.resources = resources; } public final Object handleGetObject(String key) { if (key == null) { throw new NullPointerException(); } return resources.get(key); // this class ignores locales } public Enumeration getKeys() { return Collections.enumeration(Collections.unmodifiableCollection(resources.keySet())); } } }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
