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;
14:
15: /**
16: * Base class for icons.
17: *
18: * @author <a href="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
19: */
20: public abstract class SAbstractIcon implements SIcon {
21:
22: /**
23: * The width of the icon. This is the width it is rendered, not
24: * the real width of the icon. A value <0 means, no width is rendered
25: */
26: protected int width = -1;
27:
28: /**
29: * The height of the icon. This is the height it is rendered, not
30: * the real width of the icon. A value <0 means, no height is rendered
31: */
32: protected int height = -1;
33:
34: /**
35: * Title of icon, <code>""</code> if not set.
36: */
37: protected String title = null;
38:
39: protected SAbstractIcon() {
40: }
41:
42: protected SAbstractIcon(int width, int height) {
43: setIconWidth(width);
44: setIconHeight(height);
45: }
46:
47: /**
48: * Returns the width of the icon.
49: * @return the width or -1 if unknown
50: */
51: public int getIconWidth() {
52: return width;
53: }
54:
55: /**
56: * Returns the height of the icon.
57: * @return the height or -1 if unknown
58: */
59: public int getIconHeight() {
60: return height;
61: }
62:
63: /**
64: * Sets the width of the icon.
65: * @param w the width of the icon
66: */
67: public void setIconWidth(int w) {
68: width = w;
69: }
70:
71: public void setIconHeight(int h) {
72: height = h;
73: }
74:
75: public String getIconTitle() {
76: return (title != null) ? title : "";
77: }
78:
79: public void setIconTitle(String title) {
80: this .title = title;
81: }
82: }// SAbstractIcon
|