Example usage for org.apache.wicket.resource Properties getAll

List of usage examples for org.apache.wicket.resource Properties getAll

Introduction

In this page you can find the example usage for org.apache.wicket.resource Properties getAll.

Prototype

public final ValueMap getAll() 

Source Link

Document

Get direct access to all values from the properties file.

Usage

From source file:org.wicketstuff.extjs.util.ExtConfigResourceLoader.java

License:Apache License

private void matchProps(Properties props, String keyPrefix, Config config) {
    // Lookup the value
    Iterator i = props.getAll().keySet().iterator();
    while (i.hasNext()) {
        String name = (String) i.next();
        if (name.startsWith(keyPrefix + ".")) {
            String property = name.substring(keyPrefix.length() + 1);
            config.putIfNotExists(property, Ext.parseValue(props.getString(name)));
        }/*ww  w .j  a v a2 s. c  o m*/
    }
}

From source file:org.wicketstuff.js.ext.ExtObservableHelper.java

License:Apache License

static JSONObject renderResources(final IExtObservable extObservable, Class<?> baseClass) throws JSONException {
    JSONObject resources = new JSONObject();

    IPropertiesFactory propertiesFactory = Application.get().getResourceSettings().getPropertiesFactory();
    Session session = Session.get();/*www . j av  a2s.c o m*/
    String style = session.getStyle();
    Locale locale = session.getLocale();

    Class<?> clazz = extObservable.getClass();
    while (clazz != baseClass) {
        String path = clazz.getName().replace('.', '/');
        ResourceNameIterator iter = new ResourceNameIterator(path, style, null, locale, null, false);
        while (iter.hasNext()) {
            String newPath = iter.next();

            final Properties props = propertiesFactory.load(clazz, newPath);
            if (props != null) {
                ValueMap all = props.getAll();
                for (Map.Entry<String, Object> entry : all.entrySet()) {
                    if (!resources.has(entry.getKey())) {
                        resources.put(entry.getKey(), entry.getValue());
                    }
                }
            }
        }
        clazz = clazz.getSuperclass();
    }
    return resources;
}