0N/A/*
2362N/A * Copyright (c) 1997, 2007, 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.util.Enumeration;
0N/A
0N/A/**
0N/A * A collection of unique attributes. This is a read-only,
0N/A * immutable interface. An attribute is basically a key and
0N/A * a value assigned to the key. The collection may represent
0N/A * something like a style run, a logical style, etc. These
0N/A * are generally used to describe features that will contribute
0N/A * to some graphical representation such as a font. The
0N/A * set of possible keys is unbounded and can be anything.
0N/A * Typically View implementations will respond to attribute
0N/A * definitions and render something to represent the attributes.
0N/A * <p>
0N/A * Attributes can potentially resolve in a hierarchy. If a
0N/A * key doesn't resolve locally, and a resolving parent
0N/A * exists, the key will be resolved through the parent.
0N/A *
0N/A * @author Timothy Prinzing
0N/A * @see MutableAttributeSet
0N/A */
0N/Apublic interface AttributeSet {
0N/A
0N/A /**
0N/A * This interface is the type signature that is expected
0N/A * to be present on any attribute key that contributes to
0N/A * the determination of what font to use to render some
0N/A * text. This is not considered to be a closed set, the
0N/A * definition can change across version of the platform and can
0N/A * be amended by additional user added entries that
0N/A * correspond to logical settings that are specific to
0N/A * some type of content.
0N/A */
0N/A public interface FontAttribute {
0N/A }
0N/A
0N/A /**
0N/A * This interface is the type signature that is expected
0N/A * to be present on any attribute key that contributes to
0N/A * presentation of color.
0N/A */
0N/A public interface ColorAttribute {
0N/A }
0N/A
0N/A /**
0N/A * This interface is the type signature that is expected
0N/A * to be present on any attribute key that contributes to
0N/A * character level presentation. This would be any attribute
0N/A * that applies to a so-called <term>run</term> of
0N/A * style.
0N/A */
0N/A public interface CharacterAttribute {
0N/A }
0N/A
0N/A /**
0N/A * This interface is the type signature that is expected
0N/A * to be present on any attribute key that contributes to
0N/A * the paragraph level presentation.
0N/A */
0N/A public interface ParagraphAttribute {
0N/A }
0N/A
0N/A /**
0N/A * Returns the number of attributes that are defined locally in this set.
0N/A * Attributes that are defined in the parent set are not included.
0N/A *
0N/A * @return the number of attributes >= 0
0N/A */
0N/A public int getAttributeCount();
0N/A
0N/A /**
0N/A * Checks whether the named attribute has a value specified in
0N/A * the set without resolving through another attribute
0N/A * set.
0N/A *
0N/A * @param attrName the attribute name
0N/A * @return true if the attribute has a value specified
0N/A */
0N/A public boolean isDefined(Object attrName);
0N/A
0N/A /**
0N/A * Determines if the two attribute sets are equivalent.
0N/A *
0N/A * @param attr an attribute set
0N/A * @return true if the sets are equivalent
0N/A */
0N/A public boolean isEqual(AttributeSet attr);
0N/A
0N/A /**
0N/A * Returns an attribute set that is guaranteed not
0N/A * to change over time.
0N/A *
0N/A * @return a copy of the attribute set
0N/A */
0N/A public AttributeSet copyAttributes();
0N/A
0N/A /**
0N/A * Fetches the value of the given attribute. If the value is not found
0N/A * locally, the search is continued upward through the resolving
0N/A * parent (if one exists) until the value is either
0N/A * found or there are no more parents. If the value is not found,
0N/A * null is returned.
0N/A *
0N/A * @param key the non-null key of the attribute binding
0N/A * @return the value of the attribute, or {@code null} if not found
0N/A */
0N/A public Object getAttribute(Object key);
0N/A
0N/A /**
0N/A * Returns an enumeration over the names of the attributes that are
0N/A * defined locally in the set. Names of attributes defined in the
0N/A * resolving parent, if any, are not included. The values of the
0N/A * <code>Enumeration</code> may be anything and are not constrained to
0N/A * a particular <code>Object</code> type.
0N/A * <p>
0N/A * This method never returns {@code null}. For a set with no attributes, it
0N/A * returns an empty {@code Enumeration}.
0N/A *
0N/A * @return the names
0N/A */
0N/A public Enumeration<?> getAttributeNames();
0N/A
0N/A /**
0N/A * Returns {@code true} if this set defines an attribute with the same
0N/A * name and an equal value. If such an attribute is not found locally,
0N/A * it is searched through in the resolving parent hierarchy.
0N/A *
0N/A * @param name the non-null attribute name
0N/A * @param value the value
0N/A * @return {@code true} if the set defines the attribute with an
0N/A * equal value, either locally or through its resolving parent
0N/A * @throws NullPointerException if either {@code name} or
0N/A * {@code value} is {@code null}
0N/A */
0N/A public boolean containsAttribute(Object name, Object value);
0N/A
0N/A /**
0N/A * Returns {@code true} if this set defines all the attributes from the
0N/A * given set with equal values. If an attribute is not found locally,
0N/A * it is searched through in the resolving parent hierarchy.
0N/A *
0N/A * @param attributes the set of attributes to check against
0N/A * @return {@code true} if this set defines all the attributes with equal
0N/A * values, either locally or through its resolving parent
0N/A * @throws NullPointerException if {@code attributes} is {@code null}
0N/A */
0N/A public boolean containsAttributes(AttributeSet attributes);
0N/A
0N/A /**
0N/A * Gets the resolving parent.
0N/A *
0N/A * @return the parent
0N/A */
0N/A public AttributeSet getResolveParent();
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 = StyleConstants.NameAttribute;
0N/A
0N/A /**
0N/A * Attribute name used to identify the resolving parent
0N/A * set of attributes, if one is defined.
0N/A */
0N/A public static final Object ResolveAttribute = StyleConstants.ResolveAttribute;
0N/A
0N/A}