Class SimpleStyle

java.lang.Object
javax.swing.text.SimpleAttributeSet
com.nomagic.magicreport.format.html.SimpleStyle
All Implemented Interfaces:
Serializable, Cloneable, AttributeSet, MutableAttributeSet, Style
Direct Known Subclasses:
CellStyle, ColumnStyle, GraphicStyle, ParagraphStyle, RowStyle, TableStyle, TextStyle

@OpenApiAll public class SimpleStyle extends SimpleAttributeSet implements Style
A straightforward implementation of Style using a SimpleAttributeSet.
Since:
Jun 1, 2009
See Also:
  • Field Details

    • listenerList

      protected EventListenerList listenerList
      The change listeners for the model.
    • changeEvent

      protected transient ChangeEvent changeEvent
      Only one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property. The source of events generated here is always "this".
  • Constructor Details

    • SimpleStyle

      public SimpleStyle()
      Creates a new style, with a null name and parent.
    • SimpleStyle

      public SimpleStyle(String name)
      Creates a new style.
      Parameters:
      name - the style name, null for unnamed
    • SimpleStyle

      public SimpleStyle(Style parent)
      Creates a new style.
      Parameters:
      parent - the parent style, null if none
    • SimpleStyle

      public SimpleStyle(String name, Style parent)
      Creates a new style.
      Parameters:
      name - the style name, null for unnamed
      parent - the parent style, null if none
  • Method Details

    • getName

      public String getName()
      Fetches the name of the style. A style is not required to be named, so null is returned if there is no name associated with the style.
      Specified by:
      getName in interface Style
      Returns:
      the name
    • setName

      public void setName(String name)
      Changes the name of the style. Does nothing with a null name.
      Parameters:
      name - the new name
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Adds a change listener.
      Specified by:
      addChangeListener in interface Style
      Parameters:
      l - the change listener
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Removes a change listener.
      Specified by:
      removeChangeListener in interface Style
      Parameters:
      l - the change listener
    • getChangeListeners

      public ChangeListener[] getChangeListeners()
      Returns an array of all the ChangeListeners added to this SimpleStyle with addChangeListener().
      Returns:
      all of the ChangeListeners added or an empty array if no listeners have been added
      Since:
      1.4
    • fireStateChanged

      protected void fireStateChanged()
      Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the parameters passed into the fire method.
      See Also:
    • getListeners

      public <T extends EventListener> T[] getListeners(Class<T> listenerType)
      Return an array of all the listeners of the given type that were added to this model.
      Type Parameters:
      T - EventListener
      Parameters:
      listenerType - listener class
      Returns:
      all of the objects receiving listenerType notifications from this model
    • addAttribute

      public void addAttribute(Object name, Object value)
      Adds an attribute.
      Specified by:
      addAttribute in interface MutableAttributeSet
      Overrides:
      addAttribute in class SimpleAttributeSet
      Parameters:
      name - the non-null attribute name
      value - the attribute value
    • addAttributes

      public void addAttributes(AttributeSet attr)
      Adds a set of attributes to the element.
      Specified by:
      addAttributes in interface MutableAttributeSet
      Overrides:
      addAttributes in class SimpleAttributeSet
      Parameters:
      attr - the attributes to add
    • removeAttribute

      public void removeAttribute(Object name)
      Removes an attribute from the set.
      Specified by:
      removeAttribute in interface MutableAttributeSet
      Overrides:
      removeAttribute in class SimpleAttributeSet
      Parameters:
      name - the non-null attribute name
    • removeAttributes

      public void removeAttributes(Enumeration<?> names)
      Removes a set of attributes for the element.
      Specified by:
      removeAttributes in interface MutableAttributeSet
      Overrides:
      removeAttributes in class SimpleAttributeSet
      Parameters:
      names - the attribute names
    • removeAttributes

      public void removeAttributes(AttributeSet attrs)
      Removes a set of attributes for the element.
      Specified by:
      removeAttributes in interface MutableAttributeSet
      Overrides:
      removeAttributes in class SimpleAttributeSet
      Parameters:
      attrs - the attributes
    • hashCode

      public int hashCode()
      Returns a hashcode for this set of attributes.
      Overrides:
      hashCode in class SimpleAttributeSet
      Returns:
      a hashcode value for this set of attributes.
    • equals

      public boolean equals(Object obj)
      Compares this object to the specified object. The result is true if the object is an equivalent set of attributes.
      Overrides:
      equals in class SimpleAttributeSet
      Parameters:
      obj - the object to compare this attribute set with
      Returns:
      true if the objects are equal; false otherwise