KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonbeller > wcf > convert > NodeConverterBase


1 /*
2  * ====================================================================
3  * This software is subject to the terms of the Common Public License
4  * Agreement, available at the following URL:
5  * http://www.opensource.org/licenses/cpl.html .
6  * Copyright (C) 2003-2004 TONBELLER AG.
7  * All Rights Reserved.
8  * You must accept the terms of that agreement to use this software.
9  * ====================================================================
10  *
11  *
12  */

13 package com.tonbeller.wcf.convert;
14
15 import java.util.Locale JavaDoc;
16 import java.util.ResourceBundle JavaDoc;
17
18 import org.w3c.dom.Element JavaDoc;
19
20 import com.tonbeller.wcf.format.FormatException;
21
22
23 /**
24  * @author andreas
25  */

26 public abstract class NodeConverterBase implements NodeConverter {
27   String JavaDoc elementName;
28
29   /**
30    * Returns the elementName.
31    * @return String
32    */

33   public String JavaDoc getElementName() {
34     return elementName;
35   }
36
37   /**
38    * Sets the elementName.
39    * @param elementName The elementName to set
40    */

41   public void setElementName(String JavaDoc elementName) {
42     this.elementName = elementName;
43   }
44   /**
45    * throws a format exception if the
46    */

47   public void checkRequired(Locale JavaDoc locale, Element JavaDoc elem, boolean empty) {
48     if (!"true".equals(elem.getAttribute("required")))
49       return;
50     if (empty) {
51       ResourceBundle JavaDoc rb = ResourceBundle.getBundle("com.tonbeller.wcf.convert.messages", locale);
52       throw new FormatException(rb.getString("wcf.input.required"));
53     }
54   }
55
56 }
57
Popular Tags