Libraries.Web.Page.WindowAttributeAccepter Documentation

The WindowAttributeAccepter class is designed as a helper to ease adding and removing window 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 WindowAttributeAccepter class.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter

class body is WindowAttributeAccepter, WebGenerator
    action Generate returns text
        text result = "<body "
        result = result + GenerateAttributes()
        result = result + ">
"
        result = result + me:GenerateNestedTags()
        result = result + "</body>"
        return result
    end
end

Inherits from: Libraries.Web.Page.AttributeAccepter, Libraries.Language.Object

Summary

Actions Summary Table

ActionsDescription
Add(Libraries.Web.Page.Attribute attribute)This action adds an attribute to this object.
AddAttribute(text name, text value)This action adds an attribute to this object.
Compare(Libraries.Language.Object object)This action compares two object hash codes and returns a CompareResult.
Equals(Libraries.Language.Object object)This action determines if two objects are equal based on their hash code values.
GenerateAttributes()This action returns a text description of all attributes stored.
GetAttribute(text name)This action returns an attribute from this object's Attributes object.
GetAttributeValue(text name)This action returns an attribute from this object's Attributes object.
GetAttributes()Returns a list of all attributes on the system.
GetHashCode()This action gets the hash code for an object.
GetIterator()This action returns an iterator of all attributes stored in this object.
GetNumberOfAttributes()This action returns the number of attributes that are currently stored in this object.
GetOnAHasChange()Returns the OnAHasChange attribute.
GetOnAfterPrint()Returns the OnAfterPrint attribute.
GetOnBeforePrint()Returns the OnBeforePrint attribute.
GetOnError()Returns the OnError attribute.
GetOnLoad()Returns the OnLoad attribute.
GetOnMessage()Returns the OnMessage attribute.
GetOnOffline()Returns the OnOffline attribute.
GetOnOnline()Returns the OnOnline attribute.
GetOnPageHide()Returns the OnPageHide attribute.
GetOnPageShow()Returns the OnPageShow attribute.
GetOnPopState()Returns the OnPopState attribute.
GetOnRedo()Returns the OnRedo attribute.
GetOnResize()Returns the OnResize attribute.
GetOnStorage()Returns the OnStorage attribute.
GetOnUndo()Returns the OnUndo attribute.
GetOnUnload()Returns the OnUnload attribute.
HasAttribute(text name)This action returns whether or not an attribute exists for the key passed in as a parameter.
RemoveAttribute(text name)This action removes an attribute with a particular key.
SetOnAfterPrint(text value)Sets the OnAfterPrint attribute script when the OnAfterPrint event is triggered.
SetOnBeforePrint(text value)Sets the OnBeforePrint attribute script when the OnBeforePrint event is triggered.
SetOnBeforeUnload(text value)Sets the OnBeforeUnload attribute script when the OnBeforeUnload event is triggered.
SetOnError(text value)Sets the OnError attribute script when the OnError event is triggered.
SetOnHasChange(text value)Sets the OnHasChange attribute script when the OnHasChange event is triggered.
SetOnLoad(text value)Sets the OnLoad attribute script when the OnLoad event is triggered.
SetOnMessage(text value)Sets the OnMessage attribute script when the OnMessage event is triggered.
SetOnOffline(text value)Sets the OnOffline attribute script when the OnOffline event is triggered.
SetOnOnline(text value)Sets the OnOnline attribute script when the OnOnline event is triggered.
SetOnPageHide(text value)Sets the OnPageHide attribute script when the OnPageHide event is triggered.
SetOnPageShow(text value)Sets the OnPageShow attribute script when the OnPageShow event is triggered.
SetOnPopState(text value)Sets the OnPopState attribute script when the OnPopState event is triggered.
SetOnRedo(text value)Sets the OnRedo attribute script when the OnRedo event is triggered.
SetOnResize(text value)Sets the OnResize attribute script when the OnResize event is triggered.
SetOnStorage(text value)Sets the OnStorage attribute script when the OnStorage event is triggered.
SetOnUndo(text value)Sets the OnUndo attribute script when the OnUndo event is triggered.
SetOnUnload(text value)Sets the OnUnload attribute script when the OnUnload event is triggered.

Actions Documentation

Add(Libraries.Web.Page.Attribute attribute)

This action adds an attribute to this object. If an attribute with the same name as

Example Code

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)

Parameters

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

Example Code

use Libraries.Web.Page.AttributeAccepter
        use Libraries.Web.Page.Attribute

        AttributeAccepter accept
        accept:AddAttribute("src", "http://www.google.com")

Parameters

Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns a CompareResult. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Example Code

use Libraries.Language.Support.CompareResult
        Object o
        Object t
        CompareResult result = o:Compare(t)

Parameters

Return

Libraries.Language.Support.CompareResult: The Compare result, Smaller, Equal, or Larger.

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

Example Code

use Libraries.Language.Object
        use Libraries.Language.Types.Text
        Object o
        Text t
        boolean result = o:Equals(t)

Parameters

Return

boolean: True if the hash codes are equal and false if they are not equal.

GenerateAttributes()

This action returns a text description of all attributes stored.

Example Code

use Libraries.Web.Page.AttributeAccepter
        use Libraries.Web.Page.Attribute

        AttributeAccepter accept
        accept:AddAttribute("src", "http://www.google.com")
        text result = accept:GenerateAttributes()

Return

text:

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.

Example Code

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")

Parameters

Return

Libraries.Web.Page.Attribute:

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.

Example Code

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")

Parameters

Return

text:

GetAttributes()

Returns a list of all attributes on the system.

Example Code

use Libraries.Web.Page.AttributeAccepter
        use Libraries.Web.Page.Attributes

        AttributeAccepter accept
        Attributes attributes = accept:GetAttributes()

Return

Libraries.Web.Page.Attributes: The attributes class contains all of the attributes that have been set for this object.

GetHashCode()

This action gets the hash code for an object.

Example Code

Object o
        integer hash = o:GetHashCode()

Return

integer: The integer hash code of the object.

GetIterator()

This action returns an iterator of all attributes stored in this object.

Example Code

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

Return

Libraries.Containers.Iterator:

GetNumberOfAttributes()

This action returns the number of attributes that are currently stored in this object.

Example Code

use Libraries.Web.Page.AttributeAccepter
        use Libraries.Web.Page.Attribute

        AttributeAccepter accept
        accept:AddAttribute("src", "http://www.google.com")
        integer num = accept:GetNumberOfAttributes()

Return

integer:

GetOnAHasChange()

Returns the OnAHasChange attribute. If a window change event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnAHasChange()

Return

Libraries.Web.Page.Attribute: The current OnAHasChange attribute.

GetOnAfterPrint()

Returns the OnAfterPrint attribute. After a output event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnAfterPrint()

Return

Libraries.Web.Page.Attribute: The current OnAfterPrint attribute.

GetOnBeforePrint()

Returns the OnBeforePrint attribute. Before a output event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnBeforePrint()

Return

Libraries.Web.Page.Attribute: The current OnBeforePrint attribute.

GetOnError()

Returns the OnError attribute. When an error event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnError()

Return

Libraries.Web.Page.Attribute: The current OnError attribute.

GetOnLoad()

Returns the OnLoad attribute. If a load event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnLoad()

Return

Libraries.Web.Page.Attribute: The current OnLoad attribute.

GetOnMessage()

Returns the OnMessage attribute. If a message event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnMessage()

Return

Libraries.Web.Page.Attribute: The current OnMessage attribute.

GetOnOffline()

Returns the OnOffline attribute. If a window offline event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnOffline()

Return

Libraries.Web.Page.Attribute: The current OnOffline attribute.

GetOnOnline()

Returns the OnOnline attribute. If an online event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnOnline()

Return

Libraries.Web.Page.Attribute: The current OnOnline attribute.

GetOnPageHide()

Returns the OnPageHide attribute. When a page is hidden event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnPageHide()

Return

Libraries.Web.Page.Attribute: The current OnPageHide attribute.

GetOnPageShow()

Returns the OnPageShow attribute. When a page show event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnPageShow()

Return

Libraries.Web.Page.Attribute: The current OnPageShow attribute.

GetOnPopState()

Returns the OnPopState attribute. When a windows history change event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnPopState()

Return

Libraries.Web.Page.Attribute: The current OnPopState attribute.

GetOnRedo()

Returns the OnRedo attribute. When a page redo event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnRedo()

Return

Libraries.Web.Page.Attribute: The current OnRedo attribute.

GetOnResize()

Returns the OnResize attribute. After a window resize event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnResize()

Return

Libraries.Web.Page.Attribute: The current OnResize attribute.

GetOnStorage()

Returns the OnStorage attribute. If a window storage area is updated on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnStorage()

Return

Libraries.Web.Page.Attribute: The current OnStorage attribute.

GetOnUndo()

Returns the OnUndo attribute. If a window undo event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnUndo()

Return

Libraries.Web.Page.Attribute: The current OnUndo attribute.

GetOnUnload()

Returns the OnUnload attribute. After a browser window close event occurs on a specified element a script is fired based on this attribute.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        Attribute attribute = accept:GetOnUnload()

Return

Libraries.Web.Page.Attribute: The current OnUnload attribute.

HasAttribute(text name)

This action returns whether or not an attribute exists for the key passed in as a parameter.

Example Code

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.
        boolean exists = accept:HasAttribute("src")

Parameters

Return

boolean:

RemoveAttribute(text name)

This action removes an attribute with a particular key. If that attribute does not exist, then this action returns undefined.

Example Code

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.
        accept:RemoveAttribute("src")

Parameters

Return

Libraries.Web.Page.Attribute:

SetOnAfterPrint(text value)

Sets the OnAfterPrint attribute script when the OnAfterPrint event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnAfterPrint("doSomething()")

Parameters

SetOnBeforePrint(text value)

Sets the OnBeforePrint attribute script when the OnBeforePrint event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnBeforePrint("doSomething()")

Parameters

SetOnBeforeUnload(text value)

Sets the OnBeforeUnload attribute script when the OnBeforeUnload event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnBeforeUnload("doSomething()")

Parameters

SetOnError(text value)

Sets the OnError attribute script when the OnError event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnError("doSomething()")

Parameters

SetOnHasChange(text value)

Sets the OnHasChange attribute script when the OnHasChange event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnHasChange("doSomething()")

Parameters

SetOnLoad(text value)

Sets the OnLoad attribute script when the OnLoad event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnLoad("doSomething()")

Parameters

SetOnMessage(text value)

Sets the OnMessage attribute script when the OnMessage event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnMessage("doSomething()")

Parameters

SetOnOffline(text value)

Sets the OnOffline attribute script when the OnOffline event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnOffline("doSomething()")

Parameters

SetOnOnline(text value)

Sets the OnOnline attribute script when the OnOnline event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnOnline("doSomething()")

Parameters

SetOnPageHide(text value)

Sets the OnPageHide attribute script when the OnPageHide event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnPageHide("doSomething()")

Parameters

SetOnPageShow(text value)

Sets the OnPageShow attribute script when the OnPageShow event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnPageShow("doSomething()")

Parameters

SetOnPopState(text value)

Sets the OnPopState attribute script when the OnPopState event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnPopState("doSomething()")

Parameters

SetOnRedo(text value)

Sets the OnRedo attribute script when the OnRedo event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnRedo("doSomething()")

Parameters

SetOnResize(text value)

Sets the OnResize attribute script when the OnResize event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnResize("doSomething()")

Parameters

SetOnStorage(text value)

Sets the OnStorage attribute script when the OnStorage event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnStorage("doSomething()")

Parameters

SetOnUndo(text value)

Sets the OnUndo attribute script when the OnUndo event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnUndo("doSomething()")

Parameters

SetOnUnload(text value)

Sets the OnUnload attribute script when the OnUnload event is triggered.

Example Code

use Libraries.Web.Page.WindowAttributeAccepter
        use Libraries.Web.Page.Attribute

        WindowAttributeAccepter accept
        accept:SetOnUnload("doSomething()")

Parameters