Hi, On Thu, Aug 29, 2024 at 4:02 PM mscoon <msc...@gmail.com> wrote:
> 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) { > while (ret == null) { To look in the interfaces of the base classes too ?! > 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? > It looks OK to me! If it works as you want it then it is good enough! > > Thanks in advance! > Marios >