Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * ScriptType.java
  3. * $Id$
  4. *
  5. * Created: Mon Nov 26 22:46:05 2001
  6. *
  7. *
  8. * Copyright 1999-2003 The Apache Software Foundation.
  9. *
  10. * Licensed under the Apache License, Version 2.0 (the "License");
  11. * you may not use this file except in compliance with the License.
  12. * You may obtain a copy of the License at
  13. *
  14. * http://www.apache.org/licenses/LICENSE-2.0
  15. *
  16. * Unless required by applicable law or agreed to in writing, software
  17. * distributed under the License is distributed on an "AS IS" BASIS,
  18. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  19. * See the License for the specific language governing permissions and
  20. * limitations under the License.
  21. *
  22. *
  23. * @author <a href="mailto:pbwest@powerup.com.au">Peter B. West</a>
  24. * @version $Revision$ $Name$
  25. */
  26. package org.apache.fop.datatypes;
  27. import org.apache.fop.fo.PropNames;
  28. import org.apache.fop.fo.expr.PropertyException;
  29. import org.apache.fop.fo.properties.Property;
  30. /**
  31. * A class for <tt>script</tt> specifiers.
  32. */
  33. public class ScriptType extends NCName {
  34. private static final String tag = "$Name$";
  35. private static final String revision = "$Revision$";
  36. public ScriptType(int property, String scriptCode) throws PropertyException
  37. {
  38. super(property, scriptCode, PropertyValue.SCRIPT);
  39. // Validate the code
  40. String code;
  41. if ((code = CountryLanguageScript.canonicalScriptCode(scriptCode))
  42. == null)
  43. throw new PropertyException
  44. ("Invalid script code: " + scriptCode);
  45. setString(code);
  46. }
  47. public ScriptType(String propertyName, String scriptCode)
  48. throws PropertyException
  49. {
  50. this(PropNames.getPropertyIndex(propertyName), scriptCode);
  51. }
  52. /**
  53. * @return the <tt>String</tt> script code.
  54. */
  55. public String getScript() {
  56. return string;
  57. }
  58. /**
  59. * Validate the <i>ScriptType</i> against the associated property.
  60. */
  61. public void validate() throws PropertyException {
  62. super.validate(Property.SCRIPT_T);
  63. }
  64. }