01: /**
02: * ===========================================
03: * JFreeReport : a free Java reporting library
04: * ===========================================
05: *
06: * Project Info: http://reporting.pentaho.org/
07: *
08: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
09: *
10: * This library is free software; you can redistribute it and/or modify it under the terms
11: * of the GNU Lesser General Public License as published by the Free Software Foundation;
12: * either version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
15: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16: * See the GNU Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public License along with this
19: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20: * Boston, MA 02111-1307, USA.
21: *
22: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
23: * in the United States and other countries.]
24: *
25: * ------------
26: * BoxSizing.java
27: * ------------
28: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
29: */package org.jfree.report.style;
30:
31: import java.io.ObjectStreamException;
32: import java.io.Serializable;
33:
34: import org.jfree.report.util.ObjectStreamResolveException;
35:
36: /**
37: * Creation-Date: 30.10.2005, 19:37:35
38: *
39: * @author Thomas Morgner
40: */
41: public class BoxSizing implements Serializable {
42: public static final BoxSizing CONTENT_BOX = new BoxSizing(
43: "content-box");
44: public static final BoxSizing BORDER_BOX = new BoxSizing(
45: "border-box");
46: private String type;
47:
48: private BoxSizing(final String type) {
49: this .type = type;
50: }
51:
52: public boolean equals(final Object o) {
53: if (this == o) {
54: return true;
55: }
56: if (o == null || getClass() != o.getClass()) {
57: return false;
58: }
59:
60: final BoxSizing that = (BoxSizing) o;
61:
62: if (type != null ? !type.equals(that.type) : that.type != null) {
63: return false;
64: }
65:
66: return true;
67: }
68:
69: public int hashCode() {
70: return (type != null ? type.hashCode() : 0);
71: }
72:
73: public String toString() {
74: return type;
75: }
76:
77: /**
78: * Replaces the automatically generated instance with one of the enumeration instances.
79: *
80: * @return the resolved element
81: *
82: * @throws java.io.ObjectStreamException if the element could not be resolved.
83: * @noinspection UNUSED_SYMBOL
84: */
85: protected Object readResolve() throws ObjectStreamException {
86: if (this .type.equals(BoxSizing.CONTENT_BOX.type)) {
87: return BoxSizing.CONTENT_BOX;
88: }
89: if (this .type.equals(BoxSizing.BORDER_BOX.type)) {
90: return BoxSizing.BORDER_BOX;
91: }
92: // unknown element alignment...
93: throw new ObjectStreamResolveException();
94: }
95:
96: }
|