net.xoetrope.optional.laf.synth
Class SynthClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by net.xoetrope.optional.laf.synth.SynthClassLoader

public class SynthClassLoader
extends java.lang.ClassLoader

Used to locate project files. This classloader is used in the XEditorResourceManager and is initialised when a project is created or opened. It searches for files within the paths specified in the paths array.

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003

$Revision: 1.6 $


Constructor Summary
SynthClassLoader()
          Creates a new instance of SynthClassLoader
SynthClassLoader(java.lang.ClassLoader parent)
          Creates a new instance of SynthClassLoader
 
Method Summary
 java.lang.Class findClass(java.lang.String name)
          Finds the names class.
protected  void generatePng(java.lang.String sourceSvg, java.lang.String resPng, int width, int height)
          Generate a PNG from an SVG
protected  void generatePngIcon(java.lang.String sourceSvg, java.lang.String resPng, int width, int height)
           
 java.net.URL getResource(java.lang.String name)
          Finds the resource with the given name.
 java.lang.Class loadClass(java.lang.String name)
          Loads a class with the specified name.
 java.lang.Class loadStubClass(java.lang.String name)
          Loads a stub class to allow hooking of the classloader structure for synth resources
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynthClassLoader

public SynthClassLoader()
Creates a new instance of SynthClassLoader


SynthClassLoader

public SynthClassLoader(java.lang.ClassLoader parent)
Creates a new instance of SynthClassLoader

Parameters:
parent - the parent classloader
Method Detail

getResource

public java.net.URL getResource(java.lang.String name)
Finds the resource with the given name. Alters the loading of SVG images to return a URl for a generated GIF.

Overrides:
getResource in class java.lang.ClassLoader
Parameters:
name - the resource file name
Returns:
the URL of the resource if it has been located or null otherwise

loadStubClass

public java.lang.Class loadStubClass(java.lang.String name)
                              throws java.lang.ClassNotFoundException
Loads a stub class to allow hooking of the classloader structure for synth resources

Parameters:
name - the name of the stub class
Returns:
the stub class
Throws:
java.lang.ClassNotFoundException - cannot load the class

loadClass

public java.lang.Class loadClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Loads a class with the specified name. Intercepts the loading of SVG files

Overrides:
loadClass in class java.lang.ClassLoader
Parameters:
name - the name of a class to load
Returns:
the new class
Throws:
java.lang.ClassNotFoundException - unable to load the class

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Finds the names class. This method should only be invoked for loading of the stub class

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
name - the name of the class
Returns:
the class
Throws:
java.lang.ClassNotFoundException - problems locating the class

generatePng

protected void generatePng(java.lang.String sourceSvg,
                           java.lang.String resPng,
                           int width,
                           int height)
                    throws java.lang.Exception
Generate a PNG from an SVG

Parameters:
sourceSvg -
resPng -
width -
height -
Throws:
java.lang.Exception

generatePngIcon

protected void generatePngIcon(java.lang.String sourceSvg,
                               java.lang.String resPng,
                               int width,
                               int height)
                        throws java.lang.Exception
Parameters:
sourceSvg -
resPng -
width -
height -
Throws:
java.lang.Exception