KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > template > TemplateUtil


1 /*
2  * $Id: TemplateUtil.java,v 1.5 2005/05/13 15:47:08 blueshift Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings.template;
15
16 import org.wings.SFont;
17
18 import java.util.StringTokenizer JavaDoc;
19
20 /**
21  * TemplateUtil.java
22  * <p/>
23  * <p/>
24  * Created: Tue Aug 6 16:41:22 2002
25  *
26  * @author (c) mercatis information systems gmbh, 1999-2002
27  * @author <a HREF="mailto:armin.haaf@mercatis.de">Armin Haaf</a>
28  * @version $Revision: 1.5 $
29  */

30 public class TemplateUtil {
31
32
33     public TemplateUtil() {
34
35     }
36
37     public static final SFont parseFont(String JavaDoc value) {
38         StringTokenizer JavaDoc s = new StringTokenizer JavaDoc(value, ",");
39         String JavaDoc fontName = s.nextToken();
40         String JavaDoc tmpFontType = s.nextToken().toUpperCase().trim();
41         int fontType = SFont.PLAIN;
42         if (tmpFontType.startsWith("B"))
43             fontType = SFont.BOLD;
44         else if (tmpFontType.startsWith("I"))
45             fontType = SFont.ITALIC;
46
47         int fontSize = 12;
48         try {
49             fontSize = Integer.parseInt(s.nextToken());
50         } catch (Exception JavaDoc e) {}
51
52         return new SFont(fontName, fontType, fontSize);
53     }
54
55 }// TemplateUtil
56

57
Popular Tags