0N/A/*
2362N/A * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage javax.swing.text;
0N/A
0N/Aimport java.awt.Color;
0N/Aimport java.awt.Component;
0N/Aimport java.awt.Toolkit;
0N/Aimport javax.swing.Icon;
0N/A
0N/A/**
0N/A * <p>
0N/A * A collection of <em>well known</em> or common attribute keys
0N/A * and methods to apply to an AttributeSet or MutableAttributeSet
0N/A * to get/set the properties in a typesafe manner.
0N/A * <p>
0N/A * The paragraph attributes form the definition of a paragraph to be rendered.
0N/A * All sizes are specified in points (such as found in postscript), a
0N/A * device independent measure.
0N/A * </p>
0N/A * <p align=center><img src="doc-files/paragraph.gif"
0N/A * alt="Diagram shows SpaceAbove, FirstLineIndent, LeftIndent, RightIndent,
0N/A * and SpaceBelow a paragraph."></p>
0N/A * <p>
0N/A *
0N/A * @author Timothy Prinzing
0N/A */
0N/Apublic class StyleConstants {
0N/A
0N/A /**
0N/A * Name of elements used to represent components.
0N/A */
0N/A public static final String ComponentElementName = "component";
0N/A
0N/A /**
0N/A * Name of elements used to represent icons.
0N/A */
0N/A public static final String IconElementName = "icon";
0N/A
0N/A /**
0N/A * Attribute name used to name the collection of
0N/A * attributes.
0N/A */
0N/A public static final Object NameAttribute = new StyleConstants("name");
0N/A
0N/A /**
0N/A * Attribute name used to identifiy the resolving parent
0N/A * set of attributes, if one is defined.
0N/A */
0N/A public static final Object ResolveAttribute = new StyleConstants("resolver");
0N/A
0N/A /**
0N/A * Attribute used to identify the model for embedded
0N/A * objects that have a model view separation.
0N/A */
0N/A public static final Object ModelAttribute = new StyleConstants("model");
0N/A
0N/A /**
0N/A * Returns the string representation.
0N/A *
0N/A * @return the string
0N/A */
0N/A public String toString() {
0N/A return representation;
0N/A }
0N/A
0N/A // ---- character constants -----------------------------------
0N/A
0N/A /**
0N/A * Bidirectional level of a character as assigned by the Unicode bidi
0N/A * algorithm.
0N/A */
0N/A public static final Object BidiLevel = new CharacterConstants("bidiLevel");
0N/A
0N/A /**
0N/A * Name of the font family.
0N/A */
0N/A public static final Object FontFamily = new FontConstants("family");
0N/A
0N/A /**
0N/A * Name of the font family.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final Object Family = FontFamily;
0N/A
0N/A /**
0N/A * Name of the font size.
0N/A */
0N/A public static final Object FontSize = new FontConstants("size");
0N/A
0N/A /**
0N/A * Name of the font size.
0N/A *
0N/A * @since 1.5
0N/A */
0N/A public static final Object Size = FontSize;
0N/A
0N/A /**
0N/A * Name of the bold attribute.
0N/A */
0N/A public static final Object Bold = new FontConstants("bold");
0N/A
0N/A /**
0N/A * Name of the italic attribute.
0N/A */
0N/A public static final Object Italic = new FontConstants("italic");
0N/A
0N/A /**
0N/A * Name of the underline attribute.
0N/A */
0N/A public static final Object Underline = new CharacterConstants("underline");
0N/A
0N/A /**
0N/A * Name of the Strikethrough attribute.
0N/A */
0N/A public static final Object StrikeThrough = new CharacterConstants("strikethrough");
0N/A
0N/A /**
0N/A * Name of the Superscript attribute.
0N/A */
0N/A public static final Object Superscript = new CharacterConstants("superscript");
0N/A
0N/A /**
0N/A * Name of the Subscript attribute.
0N/A */
0N/A public static final Object Subscript = new CharacterConstants("subscript");
0N/A
0N/A /**
0N/A * Name of the foreground color attribute.
0N/A */
0N/A public static final Object Foreground = new ColorConstants("foreground");
0N/A
0N/A /**
0N/A * Name of the background color attribute.
0N/A */
0N/A public static final Object Background = new ColorConstants("background");
0N/A
0N/A /**
0N/A * Name of the component attribute.
0N/A */
0N/A public static final Object ComponentAttribute = new CharacterConstants("component");
0N/A
0N/A /**
0N/A * Name of the icon attribute.
0N/A */
0N/A public static final Object IconAttribute = new CharacterConstants("icon");
0N/A
0N/A /**
0N/A * Name of the input method composed text attribute. The value of
0N/A * this attribute is an instance of AttributedString which represents
0N/A * the composed text.
0N/A */
0N/A public static final Object ComposedTextAttribute = new StyleConstants("composed text");
0N/A
0N/A /**
0N/A * The amount of space to indent the first
0N/A * line of the paragraph. This value may be negative
0N/A * to offset in the reverse direction. The type
0N/A * is Float and specifies the size of the space
0N/A * in points.
0N/A */
0N/A public static final Object FirstLineIndent = new ParagraphConstants("FirstLineIndent");
0N/A
0N/A /**
0N/A * The amount to indent the left side
0N/A * of the paragraph.
0N/A * Type is float and specifies the size in points.
0N/A */
0N/A public static final Object LeftIndent = new ParagraphConstants("LeftIndent");
0N/A
0N/A /**
0N/A * The amount to indent the right side
0N/A * of the paragraph.
0N/A * Type is float and specifies the size in points.
0N/A */
0N/A public static final Object RightIndent = new ParagraphConstants("RightIndent");
0N/A
0N/A /**
0N/A * The amount of space between lines
0N/A * of the paragraph.
0N/A * Type is float and specifies the size as a factor of the line height
0N/A */
0N/A public static final Object LineSpacing = new ParagraphConstants("LineSpacing");
0N/A
0N/A /**
0N/A * The amount of space above the paragraph.
0N/A * Type is float and specifies the size in points.
0N/A */
0N/A public static final Object SpaceAbove = new ParagraphConstants("SpaceAbove");
0N/A
0N/A /**
0N/A * The amount of space below the paragraph.
0N/A * Type is float and specifies the size in points.
0N/A */
0N/A public static final Object SpaceBelow = new ParagraphConstants("SpaceBelow");
0N/A
0N/A /**
0N/A * Alignment for the paragraph. The type is
0N/A * Integer. Valid values are:
0N/A * <ul>
0N/A * <li>ALIGN_LEFT
0N/A * <li>ALIGN_RIGHT
0N/A * <li>ALIGN_CENTER
0N/A * <li>ALIGN_JUSTIFED
0N/A * </ul>
0N/A *
0N/A */
0N/A public static final Object Alignment = new ParagraphConstants("Alignment");
0N/A
0N/A /**
0N/A * TabSet for the paragraph, type is a TabSet containing
0N/A * TabStops.
0N/A */
0N/A public static final Object TabSet = new ParagraphConstants("TabSet");
0N/A
0N/A /**
0N/A * Orientation for a paragraph.
0N/A */
0N/A public static final Object Orientation = new ParagraphConstants("Orientation");
0N/A /**
0N/A * A possible value for paragraph alignment. This
0N/A * specifies that the text is aligned to the left
0N/A * indent and extra whitespace should be placed on
0N/A * the right.
0N/A */
0N/A public static final int ALIGN_LEFT = 0;
0N/A
0N/A /**
0N/A * A possible value for paragraph alignment. This
0N/A * specifies that the text is aligned to the center
0N/A * and extra whitespace should be placed equally on
0N/A * the left and right.
0N/A */
0N/A public static final int ALIGN_CENTER = 1;
0N/A
0N/A /**
0N/A * A possible value for paragraph alignment. This
0N/A * specifies that the text is aligned to the right
0N/A * indent and extra whitespace should be placed on
0N/A * the left.
0N/A */
0N/A public static final int ALIGN_RIGHT = 2;
0N/A
0N/A /**
0N/A * A possible value for paragraph alignment. This
0N/A * specifies that extra whitespace should be spread
0N/A * out through the rows of the paragraph with the
0N/A * text lined up with the left and right indent
0N/A * except on the last line which should be aligned
0N/A * to the left.
0N/A */
0N/A public static final int ALIGN_JUSTIFIED = 3;
0N/A
0N/A // --- character attribute accessors ---------------------------
0N/A
0N/A /**
0N/A * Gets the BidiLevel setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value
0N/A */
0N/A public static int getBidiLevel(AttributeSet a) {
0N/A Integer o = (Integer) a.getAttribute(BidiLevel);
0N/A if (o != null) {
0N/A return o.intValue();
0N/A }
0N/A return 0; // Level 0 is base level (non-embedded) left-to-right
0N/A }
0N/A
0N/A /**
0N/A * Sets the BidiLevel.
0N/A *
0N/A * @param a the attribute set
0N/A * @param o the bidi level value
0N/A */
0N/A public static void setBidiLevel(MutableAttributeSet a, int o) {
215N/A a.addAttribute(BidiLevel, Integer.valueOf(o));
0N/A }
0N/A
0N/A /**
0N/A * Gets the component setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the component, null if none
0N/A */
0N/A public static Component getComponent(AttributeSet a) {
0N/A return (Component) a.getAttribute(ComponentAttribute);
0N/A }
0N/A
0N/A /**
0N/A * Sets the component attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param c the component
0N/A */
0N/A public static void setComponent(MutableAttributeSet a, Component c) {
0N/A a.addAttribute(AbstractDocument.ElementNameAttribute, ComponentElementName);
0N/A a.addAttribute(ComponentAttribute, c);
0N/A }
0N/A
0N/A /**
0N/A * Gets the icon setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the icon, null if none
0N/A */
0N/A public static Icon getIcon(AttributeSet a) {
0N/A return (Icon) a.getAttribute(IconAttribute);
0N/A }
0N/A
0N/A /**
0N/A * Sets the icon attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param c the icon
0N/A */
0N/A public static void setIcon(MutableAttributeSet a, Icon c) {
0N/A a.addAttribute(AbstractDocument.ElementNameAttribute, IconElementName);
0N/A a.addAttribute(IconAttribute, c);
0N/A }
0N/A
0N/A /**
0N/A * Gets the font family setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the font family, "Monospaced" as the default
0N/A */
0N/A public static String getFontFamily(AttributeSet a) {
0N/A String family = (String) a.getAttribute(FontFamily);
0N/A if (family == null) {
0N/A family = "Monospaced";
0N/A }
0N/A return family;
0N/A }
0N/A
0N/A /**
0N/A * Sets the font attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param fam the font
0N/A */
0N/A public static void setFontFamily(MutableAttributeSet a, String fam) {
0N/A a.addAttribute(FontFamily, fam);
0N/A }
0N/A
0N/A /**
0N/A * Gets the font size setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the font size, 12 as the default
0N/A */
0N/A public static int getFontSize(AttributeSet a) {
0N/A Integer size = (Integer) a.getAttribute(FontSize);
0N/A if (size != null) {
0N/A return size.intValue();
0N/A }
0N/A return 12;
0N/A }
0N/A
0N/A /**
0N/A * Sets the font size attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param s the font size
0N/A */
0N/A public static void setFontSize(MutableAttributeSet a, int s) {
215N/A a.addAttribute(FontSize, Integer.valueOf(s));
0N/A }
0N/A
0N/A /**
0N/A * Checks whether the bold attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isBold(AttributeSet a) {
0N/A Boolean bold = (Boolean) a.getAttribute(Bold);
0N/A if (bold != null) {
0N/A return bold.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A /**
0N/A * Sets the bold attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setBold(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(Bold, Boolean.valueOf(b));
0N/A }
0N/A
0N/A /**
0N/A * Checks whether the italic attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isItalic(AttributeSet a) {
0N/A Boolean italic = (Boolean) a.getAttribute(Italic);
0N/A if (italic != null) {
0N/A return italic.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A /**
0N/A * Sets the italic attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setItalic(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(Italic, Boolean.valueOf(b));
0N/A }
0N/A
0N/A /**
0N/A * Checks whether the underline attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isUnderline(AttributeSet a) {
0N/A Boolean underline = (Boolean) a.getAttribute(Underline);
0N/A if (underline != null) {
0N/A return underline.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A /**
0N/A * Checks whether the strikethrough attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isStrikeThrough(AttributeSet a) {
0N/A Boolean strike = (Boolean) a.getAttribute(StrikeThrough);
0N/A if (strike != null) {
0N/A return strike.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Checks whether the superscript attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isSuperscript(AttributeSet a) {
0N/A Boolean superscript = (Boolean) a.getAttribute(Superscript);
0N/A if (superscript != null) {
0N/A return superscript.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Checks whether the subscript attribute is set.
0N/A *
0N/A * @param a the attribute set
0N/A * @return true if set else false
0N/A */
0N/A public static boolean isSubscript(AttributeSet a) {
0N/A Boolean subscript = (Boolean) a.getAttribute(Subscript);
0N/A if (subscript != null) {
0N/A return subscript.booleanValue();
0N/A }
0N/A return false;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Sets the underline attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setUnderline(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(Underline, Boolean.valueOf(b));
0N/A }
0N/A
0N/A /**
0N/A * Sets the strikethrough attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setStrikeThrough(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(StrikeThrough, Boolean.valueOf(b));
0N/A }
0N/A
0N/A /**
0N/A * Sets the superscript attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setSuperscript(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(Superscript, Boolean.valueOf(b));
0N/A }
0N/A
0N/A /**
0N/A * Sets the subscript attribute.
0N/A *
0N/A * @param a the attribute set
0N/A * @param b specifies true/false for setting the attribute
0N/A */
0N/A public static void setSubscript(MutableAttributeSet a, boolean b) {
0N/A a.addAttribute(Subscript, Boolean.valueOf(b));
0N/A }
0N/A
0N/A
0N/A /**
0N/A * Gets the foreground color setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the color, Color.black as the default
0N/A */
0N/A public static Color getForeground(AttributeSet a) {
0N/A Color fg = (Color) a.getAttribute(Foreground);
0N/A if (fg == null) {
0N/A fg = Color.black;
0N/A }
0N/A return fg;
0N/A }
0N/A
0N/A /**
0N/A * Sets the foreground color.
0N/A *
0N/A * @param a the attribute set
0N/A * @param fg the color
0N/A */
0N/A public static void setForeground(MutableAttributeSet a, Color fg) {
0N/A a.addAttribute(Foreground, fg);
0N/A }
0N/A
0N/A /**
0N/A * Gets the background color setting from the attribute list.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the color, Color.black as the default
0N/A */
0N/A public static Color getBackground(AttributeSet a) {
0N/A Color fg = (Color) a.getAttribute(Background);
0N/A if (fg == null) {
0N/A fg = Color.black;
0N/A }
0N/A return fg;
0N/A }
0N/A
0N/A /**
0N/A * Sets the background color.
0N/A *
0N/A * @param a the attribute set
0N/A * @param fg the color
0N/A */
0N/A public static void setBackground(MutableAttributeSet a, Color fg) {
0N/A a.addAttribute(Background, fg);
0N/A }
0N/A
0N/A
0N/A // --- paragraph attribute accessors ----------------------------
0N/A
0N/A /**
0N/A * Gets the first line indent setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getFirstLineIndent(AttributeSet a) {
0N/A Float indent = (Float) a.getAttribute(FirstLineIndent);
0N/A if (indent != null) {
0N/A return indent.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets the first line indent.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setFirstLineIndent(MutableAttributeSet a, float i) {
0N/A a.addAttribute(FirstLineIndent, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the right indent setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getRightIndent(AttributeSet a) {
0N/A Float indent = (Float) a.getAttribute(RightIndent);
0N/A if (indent != null) {
0N/A return indent.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets right indent.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setRightIndent(MutableAttributeSet a, float i) {
0N/A a.addAttribute(RightIndent, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the left indent setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getLeftIndent(AttributeSet a) {
0N/A Float indent = (Float) a.getAttribute(LeftIndent);
0N/A if (indent != null) {
0N/A return indent.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets left indent.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setLeftIndent(MutableAttributeSet a, float i) {
0N/A a.addAttribute(LeftIndent, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the line spacing setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getLineSpacing(AttributeSet a) {
0N/A Float space = (Float) a.getAttribute(LineSpacing);
0N/A if (space != null) {
0N/A return space.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets line spacing.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setLineSpacing(MutableAttributeSet a, float i) {
0N/A a.addAttribute(LineSpacing, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the space above setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getSpaceAbove(AttributeSet a) {
0N/A Float space = (Float) a.getAttribute(SpaceAbove);
0N/A if (space != null) {
0N/A return space.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets space above.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setSpaceAbove(MutableAttributeSet a, float i) {
0N/A a.addAttribute(SpaceAbove, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the space below setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value, 0 if not set
0N/A */
0N/A public static float getSpaceBelow(AttributeSet a) {
0N/A Float space = (Float) a.getAttribute(SpaceBelow);
0N/A if (space != null) {
0N/A return space.floatValue();
0N/A }
0N/A return 0;
0N/A }
0N/A
0N/A /**
0N/A * Sets space below.
0N/A *
0N/A * @param a the attribute set
0N/A * @param i the value
0N/A */
0N/A public static void setSpaceBelow(MutableAttributeSet a, float i) {
0N/A a.addAttribute(SpaceBelow, new Float(i));
0N/A }
0N/A
0N/A /**
0N/A * Gets the alignment setting.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the value <code>StyleConstants.ALIGN_LEFT</code> if not set
0N/A */
0N/A public static int getAlignment(AttributeSet a) {
0N/A Integer align = (Integer) a.getAttribute(Alignment);
0N/A if (align != null) {
0N/A return align.intValue();
0N/A }
0N/A return ALIGN_LEFT;
0N/A }
0N/A
0N/A /**
0N/A * Sets alignment.
0N/A *
0N/A * @param a the attribute set
0N/A * @param align the alignment value
0N/A */
0N/A public static void setAlignment(MutableAttributeSet a, int align) {
215N/A a.addAttribute(Alignment, Integer.valueOf(align));
0N/A }
0N/A
0N/A /**
0N/A * Gets the TabSet.
0N/A *
0N/A * @param a the attribute set
0N/A * @return the <code>TabSet</code>
0N/A */
0N/A public static TabSet getTabSet(AttributeSet a) {
0N/A TabSet tabs = (TabSet)a.getAttribute(TabSet);
0N/A // PENDING: should this return a default?
0N/A return tabs;
0N/A }
0N/A
0N/A /**
0N/A * Sets the TabSet.
0N/A *
0N/A * @param a the attribute set.
0N/A * @param tabs the TabSet
0N/A */
0N/A public static void setTabSet(MutableAttributeSet a, TabSet tabs) {
0N/A a.addAttribute(TabSet, tabs);
0N/A }
0N/A
0N/A // --- privates ---------------------------------------------
0N/A
0N/A static Object[] keys = {
0N/A NameAttribute, ResolveAttribute, BidiLevel,
0N/A FontFamily, FontSize, Bold, Italic, Underline,
0N/A StrikeThrough, Superscript, Subscript, Foreground,
0N/A Background, ComponentAttribute, IconAttribute,
0N/A FirstLineIndent, LeftIndent, RightIndent, LineSpacing,
0N/A SpaceAbove, SpaceBelow, Alignment, TabSet, Orientation,
0N/A ModelAttribute, ComposedTextAttribute
0N/A };
0N/A
0N/A StyleConstants(String representation) {
0N/A this.representation = representation;
0N/A }
0N/A
0N/A private String representation;
0N/A
0N/A /**
0N/A * This is a typesafe enumeration of the <em>well-known</em>
0N/A * attributes that contribute to a paragraph style. These are
0N/A * aliased by the outer class for general presentation.
0N/A */
0N/A public static class ParagraphConstants extends StyleConstants
0N/A implements AttributeSet.ParagraphAttribute {
0N/A
0N/A private ParagraphConstants(String representation) {
0N/A super(representation);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * This is a typesafe enumeration of the <em>well-known</em>
0N/A * attributes that contribute to a character style. These are
0N/A * aliased by the outer class for general presentation.
0N/A */
0N/A public static class CharacterConstants extends StyleConstants
0N/A implements AttributeSet.CharacterAttribute {
0N/A
0N/A private CharacterConstants(String representation) {
0N/A super(representation);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * This is a typesafe enumeration of the <em>well-known</em>
0N/A * attributes that contribute to a color. These are aliased
0N/A * by the outer class for general presentation.
0N/A */
0N/A public static class ColorConstants extends StyleConstants
0N/A implements AttributeSet.ColorAttribute, AttributeSet.CharacterAttribute {
0N/A
0N/A private ColorConstants(String representation) {
0N/A super(representation);
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * This is a typesafe enumeration of the <em>well-known</em>
0N/A * attributes that contribute to a font. These are aliased
0N/A * by the outer class for general presentation.
0N/A */
0N/A public static class FontConstants extends StyleConstants
0N/A implements AttributeSet.FontAttribute, AttributeSet.CharacterAttribute {
0N/A
0N/A private FontConstants(String representation) {
0N/A super(representation);
0N/A }
0N/A }
0N/A
0N/A
0N/A}