uic.model
Class IconFactory.IconRepository

java.lang.Object
  extended byuic.model.IconFactory.IconRepository
All Implemented Interfaces:
IconFactory.Repository
Enclosing class:
IconFactory

protected static class IconFactory.IconRepository
extends Object
implements IconFactory.Repository

An IconRepository class that uses known formats from http://kdelook.org icon packages. The advantage of this one is that it is present on just about every Linux box.

The format is thus: The argument baseDir points to the dir where the formats are registered in. Each format is a directory with the format NxN; like 22x22, or 32x32. Under each format are a couple of directies like 'actions','apps','devices', 'filetypes','mimetypes'. In those catagories live the actual icons, which typically the png extension, but gif and jpg image will also be detected and used.

We currently have no support for the newest sizing dir 'scalable' which contains svg image files.


Constructor Summary
IconFactory.IconRepository(String baseDir)
          Constructor.
 
Method Summary
 InputStream getImage(String name, int size)
          Implements interface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IconFactory.IconRepository

public IconFactory.IconRepository(String baseDir)
                           throws IOException
Constructor.

Parameters:
baseDir - the absolute path to the repository.
Throws:
IOException - when the path is not found, or is not a dir.
Method Detail

getImage

public InputStream getImage(String name,
                            int size)
                     throws IOException
Implements interface

Specified by:
getImage in interface IconFactory.Repository
Parameters:
name - the name of the image, this is the name as specified in the getIcon method which again is the same name as registered in an action.
size - the requested size. If the wanted size is not found the returned size will be used to scale to the wanted size.
Returns:
an InputStream for the image, or null if nothing found.
Throws:
IOException


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence