Hi all,

We are considering the following implementation for
a ComponentStringResourceLoader. The idea is not only to search for
resources using the superclasses of the components, but also using
interfaces implemented by the components.
public class InterfaceAwareComponentStringResourceLoader extends
ComponentStringResourceLoader {
    @Override
    public String loadStringResource(Class<?> clazz, String key, Locale
locale, String style, String variation) {

       String ret = super.loadStringResource(clazz, key, locale, style,
variation);
       if (ret == null) {
          for (Class<?> i : clazz.getInterfaces()) {
             if (IResourceProvider.class.isAssignableFrom(i)) {
                ret = super.loadStringResource(i, key, locale, style,
variation);
                if (ret != null) {
                   break;
                }
             }
          }
       }
       return ret;

    }
}

What we want to do is have two different panels like this:
public class PersonFormPanel extends BaseFormPanel implements
PersonResources
public class PersonOtherPanel extends BaseOtherPanel implements
PersonResources

and given
public interface PersonResources implements IResourceProvider
and a file PersonResources.utf8.properties

we want that the two panels share the resources declared in
PersonResources.utf8.properties.

Do you see any problems with this idea/implementation?

Thanks in advance!
Marios

Reply via email to