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

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

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

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

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

Libraries.Web.Page.Attribute:

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

Libraries.Containers.Iterator:

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

GetOnAHasChange()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnAHasChange()

GetOnAfterPrint()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnAfterPrint()

GetOnBeforePrint()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnBeforePrint()

GetOnError()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnError()

GetOnLoad()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnLoad()

GetOnMessage()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnMessage()

GetOnOffline()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnOffline()

GetOnOnline()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnOnline()

GetOnPageHide()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnPageHide()

GetOnPageShow()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnPageShow()

GetOnPopState()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnPopState()

GetOnRedo()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnRedo()

GetOnResize()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnResize()

GetOnStorage()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnStorage()

GetOnUndo()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnUndo()

GetOnUnload()

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

Return

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

Example

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

WindowAttributeAccepter accept
Attribute attribute = accept:GetOnUnload()

HasAttribute(text name)

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

Parameters

  • text name: The key value in this case is described in more detail in the documentation for this class's Add actions.

Return

boolean:

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

RemoveAttribute(text name)

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

Parameters

  • text name: The name of the attribute that should be removed.

Return

Libraries.Web.Page.Attribute:

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

SetOnAfterPrint(text value)

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

Parameters

  • text value: The current OnAfterPrint attribute.

Example

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

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

SetOnBeforePrint(text value)

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

Parameters

  • text value: The current OnBeforePrint attribute.

Example

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

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

SetOnBeforeUnload(text value)

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

Parameters

  • text value: The current OnBeforeUnload attribute.

Example

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

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

SetOnError(text value)

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

Parameters

  • text value: The current OnError attribute.

Example

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

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

SetOnHasChange(text value)

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

Parameters

  • text value: The current OnHasChange attribute.

Example

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

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

SetOnLoad(text value)

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

Parameters

  • text value: The current OnLoad attribute.

Example

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

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

SetOnMessage(text value)

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

Parameters

  • text value: The current OnMessage attribute.

Example

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

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

SetOnOffline(text value)

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

Parameters

  • text value: The current OnOffline attribute.

Example

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

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

SetOnOnline(text value)

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

Parameters

  • text value: The current OnOnline attribute.

Example

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

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

SetOnPageHide(text value)

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

Parameters

  • text value: The current OnPageHide attribute.

Example

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

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

SetOnPageShow(text value)

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

Parameters

  • text value: The current OnPageShow attribute.

Example

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

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

SetOnPopState(text value)

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

Parameters

  • text value: The current OnPopState attribute.

Example

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

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

SetOnRedo(text value)

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

Parameters

  • text value: The current OnRedo attribute.

Example

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

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

SetOnResize(text value)

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

Parameters

  • text value: The current OnResize attribute.

Example

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

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

SetOnStorage(text value)

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

Parameters

  • text value: The current OnStorage attribute.

Example

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

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

SetOnUndo(text value)

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

Parameters

  • text value: The current OnUndo attribute.

Example

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

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

SetOnUnload(text value)

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

Parameters

  • text value: The current OnUnload attribute.

Example

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

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