Libraries.Web.Page.MouseAttributeAccepter Documentation
The MouseAttributeAccepter class is designed as a helper to ease adding and removing mouse event attributes from particular WebTag objects. While there is no harm in creating an object of this type, it is used most commonly by sub-classes that need to use attributes. The example for this class shows how to subclass the MouseAttributeAccepter class.
Example Code
use Libraries.Web.Page.MouseAttributeAccepter
class audio is MouseAttributeAccepter, WebGenerator
action Generate returns text
text result = "<button "
Attributes attributes = parent:WebTag:GetAttributes()
attributeText = attributes:Generate()
result = result + attributeText + ">"
result = result + me:GenerateNestedTags()
result = result + "</button>"
return result
end
end
Inherits from: Libraries.Web.Page.AttributeAccepter, Libraries.Language.Object
Actions Documentation
Add(Libraries.Web.Page.Attribute attribute)
This action adds an attribute to this object. If an attribute with the same name as
Parameters
- Libraries.Web.Page.Attribute: The attribute that will be stored.
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
Attribute attribute
attribute:SetName("src")
attribute:SetValue("http://www.google.com")
AttributeAccepter accept
accept:Add(attribute)
AddAttribute(text name, text value)
This action adds an attribute to this object. This action is a helper action, which essentially does the same thing as the Add(Attribute) action. If an attribute with the same name as
Parameters
- text name: The name of the attribute functions as a key. For example, in a link, we might have a "src" and an actual address, like google.com. In this case, the name would be equivalent to the src.
- text value: As an example of link, imagine we have a value of "src" and an actual address, like google.com. In this case, the value would be equivalent to google.com.
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
AttributeAccepter accept
accept:AddAttribute("src", "http://www.google.com")
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
GenerateAttributes()
This action returns a text description of all attributes stored.
Return
text:
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
AttributeAccepter accept
accept:AddAttribute("src", "http://www.google.com")
text result = accept:GenerateAttributes()
GetAttribute(text name)
This action returns an attribute from this object's Attributes object. If no attribute exists for a given key, this action returns undefined.
Parameters
- text name
Return
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
AttributeAccepter accept
//as we have not set any attribute, this would
//return undefined
Attribute attribute = accept:GetAttribute("src")
GetAttributeValue(text name)
This action returns an attribute from this object's Attributes object. If no attribute exists for a given key, this action returns undefined.
Parameters
- text name: The key value in this case is described in more detail in the documentation for this class's Add actions.
Return
text:
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
AttributeAccepter accept
accept:AddAttribute("src", "http://www.google.com")
//This helper action would throw an error if "src" were not set.
text value = accept:GetAttributeValue("src")
GetAttributes()
Returns a list of all attributes on the system.
Return
Libraries.Web.Page.Attributes: The attributes class contains all of the attributes that have been set for this object.
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attributes
AttributeAccepter accept
Attributes attributes = accept:GetAttributes()
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetIterator()
This action returns an iterator of all attributes stored in this object.
Return
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
use Libraries.Containers.Iterator
AttributeAccepter accept
accept:AddAttribute("src", "http://www.google.com")
//output out all of the attributes
Iterator<Attribute> it = accept:GetIterator()
repeat while it:HasNext()
Attribute at = it:Next()
output at:Generate()
end
GetNumberOfAttributes()
This action returns the number of attributes that are currently stored in this object.
Return
integer:
Example
use Libraries.Web.Page.AttributeAccepter
use Libraries.Web.Page.Attribute
AttributeAccepter accept
accept:AddAttribute("src", "http://www.google.com")
integer num = accept:GetNumberOfAttributes()
GetOnClick()
Returns the OnClick attribute. If a on click event occurs on a specified element a script is fired based on this attribute.
Return
Libraries.Web.Page.Attribute: The current OnClick attribute.
Example
use Libraries.Web.Page.MouseAttributeAccepter
use Libraries.Web.Page.Attribute
MouseAttributeAccepter accept
Attribute attribute = accept:GetOnClick()
GetOnDoubleClick()
Returns the OnDoubleClick attribute. If a on double click event occurs on a specified element a script is fired based on this attribute.
Return
Libraries.Web.Page.Attribute: The current OnDoubleClick attribute.
Example
use Libraries.Web.Page.MouseAttributeAccepter
use Libraries.Web.Page.Attribute
MouseAttributeAccepter accept
Attribute attribute = accept:GetOnDoubleClick()
GetOnDrag()
Returns the OnDrag attribute. If a on drag event occurs on a specified element a script is fired based on this attribute.
Return
Libraries.Web.Page.Attribute: The current OnDrag attribute.
Example
use Libraries.Web.Page.MouseAttributeAccepter
use Libraries.Web.Page.Attribute
MouseAttributeAccepter accept
Attribute attribute = accept:GetOnDrag()
GetOnDragEnd()
Returns the OnDragEnd attribute. If a on drag end event occurs on a spe