List of usage examples for org.apache.wicket.util.string Strings afterFirst
public static String afterFirst(final String s, final char c)
From source file:org.wicketstuff.extjs.util.ExtConfigResourceLoader.java
License:Apache License
protected void loadStringResource(final Component component, final String key, final Config config) { if (component == null) { return;//www . j av a2 s .c o m } Locale locale = component.getLocale(); String style = component.getStyle(); // The key prefix is equal to the component path relative to the // current component on the top of the stack. String prefix = Strings.replaceAll(component.getPageRelativePath(), ":", ".").toString(); // The reason why we need to create that stack is because we need to // walk it downwards starting with Page down to the Component List searchStack = getComponentStack(component); // Walk the component hierarchy down from page to the component for (int i = searchStack.size() - 1; i >= 0; i--) { Class clazz = (Class) searchStack.get(i); // First, try the fully qualified resource name relative to the // component on the path from page down. if ((prefix != null) && (prefix.length() > 0)) { loadStringResource(clazz, prefix + '.' + key, locale, style, config); prefix = Strings.afterFirst(prefix, '.'); } if (i == 0 && component.getClass().equals(clazz)) { /* * Before the last component that is supposed to contains the components default we try in the application configuration file */ loadStringResource(Application.get().getClass(), key, locale, style, config); } loadStringResource(clazz, key, locale, style, config); } }