Source code: com/steadystate/css/dom/DOMExceptionImpl.java
1 /*
2 * DOMExceptionImpl.java
3 *
4 * Steady State CSS2 Parser
5 *
6 * Copyright (C) 1999, 2002 Steady State Software Ltd. All rights reserved.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * To contact the authors of the library, write to Steady State Software Ltd.,
23 * 49 Littleworth, Wing, Buckinghamshire, LU7 0JX, England
24 *
25 * http://www.steadystate.com/css/
26 * mailto:css@steadystate.co.uk
27 *
28 * $Id: DOMExceptionImpl.java,v 1.1.1.1 2003/12/28 21:22:54 davidsch Exp $
29 */
30
31 package com.steadystate.css.dom;
32
33 import java.util.*;
34 import org.w3c.dom.*;
35
36 /**
37 *
38 * @author David Schweinsberg
39 * @version $Release$
40 */
41 public class DOMExceptionImpl extends DOMException {
42
43 public static final int SYNTAX_ERROR = 0;
44 public static final int ARRAY_OUT_OF_BOUNDS = 1;
45 public static final int READ_ONLY_STYLE_SHEET = 2;
46 public static final int EXPECTING_UNKNOWN_RULE = 3;
47 public static final int EXPECTING_STYLE_RULE = 4;
48 public static final int EXPECTING_CHARSET_RULE = 5;
49 public static final int EXPECTING_IMPORT_RULE = 6;
50 public static final int EXPECTING_MEDIA_RULE = 7;
51 public static final int EXPECTING_FONT_FACE_RULE = 8;
52 public static final int EXPECTING_PAGE_RULE = 9;
53 public static final int FLOAT_ERROR = 10;
54 public static final int STRING_ERROR = 11;
55 public static final int COUNTER_ERROR = 12;
56 public static final int RECT_ERROR = 13;
57 public static final int RGBCOLOR_ERROR = 14;
58 public static final int CHARSET_NOT_FIRST = 15;
59 public static final int CHARSET_NOT_UNIQUE = 16;
60 public static final int IMPORT_NOT_FIRST = 17;
61 public static final int NOT_FOUND = 18;
62 public static final int NOT_IMPLEMENTED = 19;
63
64 private static ResourceBundle _exceptionResource =
65 ResourceBundle.getBundle(
66 "com.steadystate.css.parser.ExceptionResource",
67 Locale.getDefault());
68
69 public DOMExceptionImpl(short code, int messageKey) {
70 super(code, _exceptionResource.getString(keyString(messageKey)));
71 }
72
73 public DOMExceptionImpl(int code, int messageKey) {
74 super((short) code, _exceptionResource.getString(keyString(messageKey)));
75 }
76
77 public DOMExceptionImpl(short code, int messageKey, String info) {
78 super(code, _exceptionResource.getString(keyString(messageKey)));
79 }
80
81 private static String keyString(int key) {
82 return "s" + String.valueOf(key);
83 }
84 }