Example usage for org.apache.wicket.util.value ValueMap getLong

List of usage examples for org.apache.wicket.util.value ValueMap getLong

Introduction

In this page you can find the example usage for org.apache.wicket.util.value ValueMap getLong.

Prototype

@Override
public final long getLong(final String key, final long defaultValue) 

Source Link

Usage

From source file:net.kornr.swit.button.ButtonResource.java

License:Apache License

@Override
public IResourceStream getResourceStream() {
    ValueMap map = this.getParameters();
    long id = map.getLong("id", -1);

    if (id > -1) {

        File cachedfile = s_fileCache.get(id);
        if (cachedfile == null)
            cachedfile = s_tempFileCache.get(id);

        if (cachedfile != null && cachedfile.exists()) {
            return new FileResourceStream(cachedfile);
        }//from  w w  w . j a  v a  2 s  .  c  o m

        boolean temporary = false;

        ButtonResourceKey k = s_cache.get(id);
        if (k == null) {
            k = s_tempCache.get(id);
            temporary = true;
        }

        File f = createImageFile(k);
        if (temporary)
            s_tempFileCache.put(id, f);
        else
            s_fileCache.put(id, f);

        return new FileResourceStream(f);
    }
    // TODO Auto-generated method stub
    return null;
}