Jx |
JxJx is a global singleton object that contains the entire Jx library within it. All Jx functions, attributes and classes are accessed through the global Jx object. Jx should not create any other global variables, if you discover that it does then please report it as a bug Summary
addStyleSheet
Individual components of Jx call this function to get their style sheets imported at run time. ParametersstyleSheet {String} the relative path to the CSS file (relative to <Jx.baseURL>). ieOnly {Boolean} if true, then the style sheet is only loaded if the browser is Internet Explorer. applyPNGFilter
Static method that applies the PNG Filter Hack for IE browsers when showing 24bit PNG’s. Used automatically for img tags with a class of png24. The filter is applied using a nifty feature of IE that allows javascript to be executed as part of a CSS style rule - this ensures that the hack only gets applied on IE browsers. Parametersobject {Object} the object (img) to which the filter needs to be applied. Jx. ListenerJx.Listener is a mix-in class that performs common listener functions for objects that support listeners. It is intended to be added to existing classes using the following syntax: Object.extends( MyClass.prototype, Jx.Listener.prototype) The Jx.Listener class functions provide support for managing a list of listeners (add, remove) and dispatching events to listeners (processEvent). Summary
Jx. UniqueIdJx.UniqueId is used to assign unique ids to selected elements This is used to solve a problem where multiple external html fragments are loaded into the DOM via ajax at runtime. It is not always possible to ensure that every element has a unique id. This is not a problem if you are using id for CSS styling but if you are using it to access elements using $() then you may get unexpected results. Jx.UniqueId is a mix-in class. Extend an existing class to enable it to handle unique ids. Register the ids that you want to be unique and then get a reference to those objects through the interface exposed by this class. The class retrieves the elements by id by walking a dom object and retains references to each of the actual DOM objects you have registered. Summary
initUniqueId
initialize the UniqueId object. This must be called prior to calling the registerIds function. Typically, it is called in the constructor of an object that includes Jx.UniqueId. registerIds
searches the domObj for each of the ids passed in and obtains a unique reference to them so that subsequent calls to getObj will return the right object. ParametersaIds {Array} an array of strings containing ids of DOM elements to register. domObj {Object} an HTML element reference to search for unique ids within Jx. ActionJx.Action is a utility class that provides a mechanism to separate the user interface code from the implementation code for a particular piece of functionality. A Jx.Action is used primarily as the basis for clickable UI elements such as Jx.Button and Jx.MenuItem that need to execute a particular function when the user clicks them. The Jx.Action includes a mechanism for controlling the state of the action, allowing an application to enable or disable an action at any time. A single Jx.Action may be used with multiple buttons and menu items, allowing the application to easily keep various user interface elements synchronized without having to explicitly maintain all of them. A new instance of Jx.Action is created by passing a function object to the constructor. The function object may be a function name or the result of using the Prototype bind() function. For example//Example 1: To enable or disable a Jx.Action (and consequently update any associated buttons or menu items), use the setEnabled([true|false]) method. For example//disable an action Summary
addPropertyChangeListener
add a property change listener to this action. When the enabled state of the action changes, all property change listeners are notified through their propertyChanged method. Parameter: {Object} obj the object to notify of property changes ElementElement is a global object provided by the prototype.js library. The functions documented here are extensions to the Element object provided by Jx to make cross-browser compatibility easier to achieve. Summary
getContentBoxSize
return the size of the content area of an element. This is the size of the element less margins, padding, and borders. Parameter: {Object} elem the element to get the content size of. Return: {Object} an object with two properties, width and height, that are the size of the content area of the measured element. getBorderBoxSize
return the size of the border area of an element. This is the size of the element less margins. Parameter: {Object} elem the element to get the border sizing of. Return: {Object} an object with two properties, width and height, that are the size of the border area of the measured element. setContentBoxSize
set either or both of the width and height of an element to the provided size. This function ensures that the content area of the element is the requested size and the resulting size of the element may be larger depending on padding and borders. Parameter: {Object} elem the element to set the content area of. Parameter: {Object} size an object with a width and/or height property that is the size to set the content area of the element to. setBorderBoxSize
set either or both of the width and height of an element to the provided size. This function ensures that the border size of the element is the requested size and the resulting content areaof the element may be larger depending on padding and borders. Parameter: {Object} elem the element to set the border size of. Parameter: {Object} size an object with a width and/or height property that is the size to set the content area of the element to. toggleMeasurable
toggles an element’s display style property so it can be measured. If the element has display: none, it is changed to display: block and made temporarily visible so that it can be measured. Calling this function a second time with the same element will revert the changes. This allows an element to be measured in various ways. Parameter: {Object} elem the element to measure. Jx. ContentLoaderContentLoader is a mix-in class that provides a consistent mechanism for other Jx controls to load content in one of four different ways:
Summary
contentLoaded
callback function that handles remote content Parameter: element the element to put the content into Parameter: options the options that were passed to loadContent originally, only used to get the optional onContentLoaded callback function. Parameter: r the XmlHttpRequest object that has the content. contentLoadFailed
callback function that handles failure to load remote content Parameter: options the options that were passed to loadContent originally, only used to get the optional onContentLoadedFailed callback function. Parameter: r the XmlHttpRequest object that has the failure code loadContent
triggers loading of content based on parameters passed in the options parameter. The options parameter can have the following attributes:
Parameter: element the element to insert the content into Parameter: options an object containing the attributes indicating what content to load. |
Individual components of Jx call this function to get their style sheets imported at run time.
Jx.addStyleSheet = function( styleSheet, ieOnly )
Static method that applies the PNG Filter Hack for IE browsers when showing 24bit PNG’s.
Jx.applyPNGFilter = function( o )
add a listener to the provided list.
addListener: function ( list, obj )
remove a listener from the provided list.
removeListener: function( list, obj )
call each listener with a given method and event.
processEvent: function( list, fnName, obj )
initialize the UniqueId object.
initUniqueId: function()
removes all registered ids
deregisterIds: function()
searches the domObj for each of the ids passed in and obtains a unique reference to them so that subsequent calls to getObj will return the right object.
registerIds: function ( aIds, domObj )
return an object by id if it was previously registered
getObj: function( id )
construct a new instance of Jx.Action that invokes a function when activated
initialize: function( f )
add a property change listener to this action.
addPropertyChangeListener: function( obj )
remove a property change listener from this action.
removePropertyChangeListener: function( obj )
return whether the action is currently enabled or not.
isEnabled: function()
set the state of this action.
setEnabled: function( b )
convenience function to bind an item to this action.
bindTo : function( item )
convenience function to undo a binding between an object and this action.
unbindFrom: function( item )
placeholder function to conform to the ActionListener interface.
actionPerformed : function( obj )
return the size of the content area of an element.
getContentBoxSize : function( elem )
return the size of the border area of an element.
getBorderBoxSize: function( elem )
set either or both of the width and height of an element to the provided size.
setContentBoxSize : function( elem, size )
set either or both of the width and height of an element to the provided size.
setBorderBoxSize : function( elem, size )
returns the padding for each edge of an element
getPaddingSize : function ( elem )
returns the border size for each edge of an element
getBorderSize : function( elem )
returns the margin size for each edge of an element
getMarginSize : function( elem )
safely parse a number and return its integer value.
getNumber: function( n )
return the dimensions of the browser client area.
getPageDimensions: function()
returns the width of the browser client area
getInsideWindowWidth: function()
returns the height of the browser client area
getInsideWindowHeight: function()
toggles an element’s display style property so it can be measured.
toggleMeasurable: function( elem )
callback function that handles remote content
contentLoaded: function( element, options, r )
callback function that handles failure to load remote content
contentLoadFailed: function( options, r )
triggers loading of content based on parameters passed in the options parameter.
loadContent: function( element, options )