01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.providers.util;
07:
08: public class Layout {
09: public final static int LAYOUT_THIN_THICK = 1;
10: public final static int LAYOUT_THICK_THIN = 2;
11: public final static int LAYOUT_THIN_THICK_THIN = 3;
12: public final static int LAYOUT_THIN_THIN_THIN = 4;
13: public final static int LAYOUT_UNKNOWN = -1;
14:
15: public static int toInt(String layout)
16: throws UnknownLayoutException {
17: if (layout.equals("thin-thick")) {
18: return LAYOUT_THIN_THICK;
19: } else if (layout.equals("thick-thin")) {
20: return LAYOUT_THICK_THIN;
21: } else if (layout.equals("thin-thick-thin")) {
22: return LAYOUT_THIN_THICK_THIN;
23: } else if (layout.equals("thin-thin-thin")) {
24: return LAYOUT_THIN_THIN_THIN;
25: } else {
26: throw new UnknownLayoutException("unknown layout=" + layout);
27: }
28: }
29:
30: public static String toString(int lo) throws UnknownLayoutException {
31: String layout = null;
32: if (lo == LAYOUT_THIN_THICK) {
33: layout = "thin-thick";
34: } else if (lo == LAYOUT_THICK_THIN) {
35: layout = "thick-thin";
36: } else if (lo == LAYOUT_THIN_THICK_THIN) {
37: layout = "thin-thick-thin";
38: } else if (lo == LAYOUT_THIN_THIN_THIN) {
39: layout = "thin-thin-thin";
40: } else {
41: throw new UnknownLayoutException("unknown layout=" + lo);
42: }
43:
44: return layout;
45: }
46: }
|