fields
protected content:ZUI
The content field is used by the default renderJQ() method. By default the component in this field is rendered and returned as the result. This allows for new user interfaces to be built using only preexisting components.
static fields
static pageManager:PageManager
This is the basic mechanism for setting up the page management of your application. An example of this can be seen in setting up the client. More information can be found in the description of the PageManager class.
attribute methods
Many ZUI components are modified by attribute methods.
css( c:string | ()=>string)
This will accept a string in the format of the HTML style attribute. That is a set of attributeName:attributeValue pairs seperated by semicolons. This will also accept a function that returns such a string so that the CSS style can dynamically change each time the user interface is rendered.
This method is rarely used because it embeds styling information into the code. The style method for referencing SCSS classes is the more common technique. However, this can be very helpful for dynamically computing some style information.
style( s: string | ()=>string )
This accepts a string or a function the returns a string. The string contains one or more SCSS class names. These are added to the default style class(es) of the component to allow UI specific changes to the styling.
This is the primary mechanism for controlling style and layout in a ZUI user interface.
Chaining attribute methods
All attribute methods return the ZUI object itself as their result so their attribute methods can be chained together. Many of the members of the ZUI component library have their own attribute methods. These subclass attribute methods will return their own subclass so that their methods can be chained. Because they are subclasses of ZUI they can be changed with the ZUI attribute methods as well. However, the ZUI attribute methods return the ZUI type which will not accept any of the subclass methods. The trick is just to use ZUI attribute methods last.
Rendering
renderJQ():JQuery
This is the basic method for converting a ZUI component into a JQuery object that can be embedded in the HTML DOM tree. Many user interfaces can ignore this method and simply build a new component out of existing components and assign the structure to the content field.
This method can be overridden to produce custom JQuery based implementations that will integrate nicely with the rest of the system. All that is necessary is to return a valid JQuery object as the result.
Static helper methods
static notify()
This is the mechanism for getting the entire ZUI page to render. ZUI.notify() should be called after every user input. This is automatically called whenever data is received from the server.
static setState( fieldName:string, newVal:any)
Every page has a state, which is discussed with page management. This method will change a field of that state.
static getState( fieldName:string ):any
This will return a specific field from the current state. This is the basic mechanism for ZUI components to extract state information.
static getUserKey():string
This will return the object key for the currently logged in user. If there is no logged in user, then null is returned.