01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.plaf;
14:
15: import org.wings.resource.ResourceManager;
16:
17: import java.io.Serializable;
18: import java.util.Properties;
19:
20: /**
21: * A Look-and-Feel consists of a bunch of CGs and resource properties.
22: * wingS provides a pluggable look-and-feel (laf or plaf) concept similar to that of Swing.
23: * A certain plaf implementation normally adresses a specific browser platform.
24: *
25: * @see org.wings.plaf.ComponentCG
26: */
27: public class LookAndFeel implements Serializable {
28: protected Properties properties;
29:
30: /**
31: * Instantiate a laf using the war's classLoader.
32: *
33: * @param properties the configuration of the laf
34: */
35: public LookAndFeel(Properties properties) {
36: this .properties = properties;
37: }
38:
39: /**
40: * Return a unique string that identifies this look and feel, e.g.
41: * "konqueror"
42: */
43: public String getName() {
44: return properties.getProperty("lookandfeel.name");
45: }
46:
47: /**
48: * Return a one line description of this look and feel implementation,
49: * e.g. "Optimized for KDE's Konqueror Browser".
50: */
51: public String getDescription() {
52: return properties.getProperty("lookandfeel.description");
53: }
54:
55: /**
56: * create a fresh CGDefaults map. One defaults map per Session is generated
57: * in its CGManager. It is necessary to create a fresh defaults map, since
58: * it caches values that might be modified within the sessions. A prominent
59: * example of changed values per sessions are the CG's themselves:
60: * CG-properties might be changed per session...
61: *
62: * @return the laf's defaults
63: */
64: public ResourceDefaults createDefaults() {
65: return new ResourceDefaults(ResourceManager.RESOURCES,
66: properties);
67: }
68:
69: /**
70: * Returns a string that displays and identifies this
71: * object's properties.
72: *
73: * @return a String representation of this object
74: */
75: public String toString() {
76: return "[" + getDescription() + " - " + getClass().getName()
77: + "]";
78: }
79: }
|