01: /*
02: * Copyright 2006 Ethan Nicholas. All rights reserved.
03: * Use is subject to license terms.
04: */
05: package jaxx;
06:
07: import java.awt.*;
08:
09: import jaxx.compiler.*;
10: import jaxx.reflect.*;
11: import jaxx.spi.*;
12: import jaxx.tags.*;
13: import jaxx.types.*;
14:
15: /** Initializes support for Swing components and types. */
16: public class DefaultInitializer implements Initializer {
17:
18: /** Called by the JAXX SPI system to initialize Swing support. */
19: public void initialize() {
20: TagManager.registerBean(ClassDescriptorLoader
21: .getClassDescriptor(Object.class),
22: DefaultObjectHandler.class);
23: TagManager.registerBean(ClassDescriptorLoader
24: .getClassDescriptor(Component.class),
25: DefaultComponentHandler.class);
26: TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "script",
27: new ScriptHandler());
28: TagManager.registerTag(JAXXCompiler.JAXX_NAMESPACE, "style",
29: new StyleHandler());
30:
31: PrimitiveConverter primitiveConverter = new PrimitiveConverter();
32: TypeManager.registerTypeConverter(boolean.class,
33: primitiveConverter);
34: TypeManager.registerTypeConverter(Boolean.class,
35: primitiveConverter);
36: TypeManager.registerTypeConverter(byte.class,
37: primitiveConverter);
38: TypeManager.registerTypeConverter(Byte.class,
39: primitiveConverter);
40: TypeManager.registerTypeConverter(short.class,
41: primitiveConverter);
42: TypeManager.registerTypeConverter(Short.class,
43: primitiveConverter);
44: TypeManager
45: .registerTypeConverter(int.class, primitiveConverter);
46: TypeManager.registerTypeConverter(Integer.class,
47: primitiveConverter);
48: TypeManager.registerTypeConverter(long.class,
49: primitiveConverter);
50: TypeManager.registerTypeConverter(Long.class,
51: primitiveConverter);
52: TypeManager.registerTypeConverter(float.class,
53: primitiveConverter);
54: TypeManager.registerTypeConverter(Float.class,
55: primitiveConverter);
56: TypeManager.registerTypeConverter(double.class,
57: primitiveConverter);
58: TypeManager.registerTypeConverter(Double.class,
59: primitiveConverter);
60: TypeManager.registerTypeConverter(char.class,
61: primitiveConverter);
62: TypeManager.registerTypeConverter(Character.class,
63: primitiveConverter);
64: TypeManager.registerTypeConverter(String.class,
65: primitiveConverter);
66:
67: TypeManager.registerTypeConverter(Color.class,
68: new ColorConverter());
69: TypeManager.registerTypeConverter(GridBagConstraints.class,
70: new GridBagConstraintsConverter());
71: TypeManager.registerTypeConverter(Insets.class,
72: new InsetsConverter());
73: }
74: }
|