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
A straightforward implementation of Style using a SimpleAttributeSet.
- Since:
- Jun 1, 2009
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ChangeEventOnly one ChangeEvent is needed per model instance since the event's only (read-only) state is the source property.protected EventListenerListThe change listeners for the model.Fields inherited from class javax.swing.text.SimpleAttributeSet
EMPTYFields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new style, with a null name and parent.SimpleStyle(String name) Creates a new style.SimpleStyle(String name, Style parent) Creates a new style.SimpleStyle(Style parent) Creates a new style. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(Object name, Object value) Adds an attribute.voidaddAttributes(AttributeSet attr) Adds a set of attributes to the element.voidAdds a change listener.booleanCompares this object to the specified object.protected voidNotifies all listeners that have registered interest for notification on this event type.Returns an array of all theChangeListeners added to this SimpleStyle with addChangeListener().<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.getName()Fetches the name of the style.inthashCode()Returns a hashcode for this set of attributes.voidremoveAttribute(Object name) Removes an attribute from the set.voidremoveAttributes(Enumeration<?> names) Removes a set of attributes for the element.voidremoveAttributes(AttributeSet attrs) Removes a set of attributes for the element.voidRemoves a change listener.voidChanges the name of the style.Methods inherited from class javax.swing.text.SimpleAttributeSet
clone, containsAttribute, containsAttributes, copyAttributes, getAttribute, getAttributeCount, getAttributeNames, getResolveParent, isDefined, isEmpty, isEqual, setResolveParent, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.swing.text.AttributeSet
containsAttribute, containsAttributes, copyAttributes, getAttribute, getAttributeCount, getAttributeNames, getResolveParent, isDefined, isEqualMethods inherited from interface javax.swing.text.MutableAttributeSet
setResolveParent
-
Field Details
-
listenerList
The change listeners for the model. -
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
Creates a new style.- Parameters:
name- the style name, null for unnamed
-
SimpleStyle
Creates a new style.- Parameters:
parent- the parent style, null if none
-
SimpleStyle
Creates a new style.- Parameters:
name- the style name, null for unnamedparent- the parent style, null if none
-
-
Method Details
-
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. -
setName
Changes the name of the style. Does nothing with a null name.- Parameters:
name- the new name
-
addChangeListener
Adds a change listener.- Specified by:
addChangeListenerin interfaceStyle- Parameters:
l- the change listener
-
removeChangeListener
Removes a change listener.- Specified by:
removeChangeListenerin interfaceStyle- Parameters:
l- the change listener
-
getChangeListeners
Returns an array of all theChangeListeners 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
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
Adds an attribute.- Specified by:
addAttributein interfaceMutableAttributeSet- Overrides:
addAttributein classSimpleAttributeSet- Parameters:
name- the non-null attribute namevalue- the attribute value
-
addAttributes
Adds a set of attributes to the element.- Specified by:
addAttributesin interfaceMutableAttributeSet- Overrides:
addAttributesin classSimpleAttributeSet- Parameters:
attr- the attributes to add
-
removeAttribute
Removes an attribute from the set.- Specified by:
removeAttributein interfaceMutableAttributeSet- Overrides:
removeAttributein classSimpleAttributeSet- Parameters:
name- the non-null attribute name
-
removeAttributes
Removes a set of attributes for the element.- Specified by:
removeAttributesin interfaceMutableAttributeSet- Overrides:
removeAttributesin classSimpleAttributeSet- Parameters:
names- the attribute names
-
removeAttributes
Removes a set of attributes for the element.- Specified by:
removeAttributesin interfaceMutableAttributeSet- Overrides:
removeAttributesin classSimpleAttributeSet- Parameters:
attrs- the attributes
-
hashCode
public int hashCode()Returns a hashcode for this set of attributes.- Overrides:
hashCodein classSimpleAttributeSet- Returns:
- a hashcode value for this set of attributes.
-
equals
Compares this object to the specified object. The result istrueif the object is an equivalent set of attributes.- Overrides:
equalsin classSimpleAttributeSet- Parameters:
obj- the object to compare this attribute set with- Returns:
trueif the objects are equal;falseotherwise
-