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]>
-- Oliver Rossmueller Software Engineer Hamburg, Germany 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()));
}
}
}
smime.p7s
Description: S/MIME Cryptographic Signature
