IRISLIB database
Utils Class Reference

This class contains various utility methods needed by the ZEN framework. More...

Inheritance diagram for Utils:
Collaboration diagram for Utils:

Static Public Member Functions

_.Library.String BuildCSSString (pParse)
 Take an array of parsed CSS declarations and combine them into a single string.
 
 ConstructClassGraph (_.Library.String pTopClass, pGraph, _.Library.String pFilter, pParentNode)
 Create a graph of a class pTopClass and its subclasses. More...
 
_.Library.Status CreateZENPageClass (_.Library.String pPage, _.Library.String pAppClass)
 Called by wizards. More...
 
 DrawClassDefinition (_.Library.String pClass)
 Wrapper to invoke DrawClassDefinition method for a class. More...
 
_.Library.Status GenerateSchema ()
 Generate the ZEN XML schema file.
 
_.Library.Status GetCSSInfo (pInfo, _.Library.String pType)
 Get CSS info from generated CSS files. More...
 
_.Library.Boolean GetComponentAttrs (_.Library.String comp, attrs, cats)
 Get list of attributes used by ZEN component comp. More...
 
_.Library.String GetDefault (_.Library.String pSetting, _.Library.String pDefault)
 Return default value of named property (used by Wizards).
 
_.Library.String GetDefaultApplication ()
 Return default application name (used by Wizards).
 
_.Library.String GetDefaultDomain ()
 Return default domain name (used by Wizards).
 
_.Library.String GetDefaultPackage ()
 Return default package name (used by Wizards).
 
_.Library.String GetSchemaFile ()
 Return file path for the ZEN XML Schema.
 
_.Library.Boolean IsComponentEmpty (_.Library.String pClass)
 Determine if component class uses an empty XML element. More...
 
_.Library.Boolean IsPage (_.Library.String pClass)
 Determine if this component class is a page.
 
 ParseCSS (_.Library.String pText, pParse)
 Utility method to parse a string, pText, containing one or more. More...
 
_.Library.Status ParseCSSFile (_.Library.String pFileName, pInfo)
 Utility method. More...
 
 SetDefault (_.Library.String pSetting, _.Library.String pName)
 Set default value of named property (used by Wizards).
 
_.Library.String SetDefaultApplication (_.Library.String pName)
 Set default application name (used by Wizards).
 
_.Library.String SetDefaultDomain (_.Library.String pName)
 Set default domain name (used by Wizards).
 
_.Library.String SetDefaultPackage (_.Library.String pName)
 Set default package name (used by Wizards).
 
_.Library.Status WriteCSSForComponent (_.Library.String pClassName, _.Library.String pStyleBlock)
 Write out the contents of the default CSS Style sheet for. More...
 
_.Library.Status WriteIncludeFilesForModule (_.Library.String pDirectory, _.Library.String pModule, pWorkList, _.Library.String pFlags)
 Utility method to write out JS and CSS Style Sheet files. More...
 
_.Library.Status WriteXMLSchema (_.Library.String pFile)
 Write out the XML schema for a ZEN page definition.
 

Static Public Attributes

 DOMAIN = None
 This class contains various utility methods needed by the ZEN framework.
 
- Static Public Attributes inherited from RegisteredObject
 CAPTION = None
 Optional name used by the Form Wizard for a class when generating forms. More...
 
 JAVATYPE = None
 The Java type to be used when exported.
 
 PROPERTYVALIDATION = None
 This parameter controls the default validation behavior for the object. More...
 

Static Private Member Functions

_.Library.Boolean BrowserSupportsHTML5 (_.Library.String pUserAgent)
 Helper method to determine whether the UserAgent in pUserAgent More...
 
 DisplayErrorHTML (_.Library.RegisteredObject pObject, _.Library.Status tSC)
 Display a status code within an HTML element.
 
 DisplayErrorJS (_.Library.RegisteredObject pObject, _.Library.Status tSC)
 Display a status code within JavaScript alert box.
 
 DisplayErrorSVG (_.Library.RegisteredObject pObject, _.Library.Status tSC)
 Display a status code within an SVG element.
 
 DrawClassDescription (_.Library.String pClass)
 Write out description of the given class as HTML.
 
 DrawPropertyDescription (_.Library.String pClass, _.Library.String pProperty)
 Write out description of the given property as HTML.
 
_.Library.String FindComponentClassByName (_.Library.String pNamespace, _.Library.String pName)
 Given an xml namespace and a component name, return the class name. More...
 
_.Library.Status GenerateIncludeFiles (_.Library.String pPackage, _.Library.String pType)
 Generate include files for a given Zen package. More...
 
_.Library.Status GenerateIncludeFilesForModules (_.Library.String pPackage, pModules, _.Library.Boolean pAll, _.Library.Boolean pDisplay)
 Generate include files for a given Zen package and. More...
 
_.Library.Status GenerateSchema ()
 Generate XML schema information needed for StudioAssist.
 
_.Library.String GetIncludeDirectory (_.Library.String pUrl)
 Return the physical directory in which common include files are written.
 
 GetLinksInPage (_.Library.String pPage, _.Library.String pList)
 Utility method. More...
 
 GetPagesInApplication (_.Library.String pApplication, _.Library.String pList)
 Return array of pages within the given application class.
 
_.Library.String GetPhysicalIncludeDirectory (_.Library.String pPackage, _.Library.Status pStatus, _.Library.String pUrl)
 Given a package name, return the physical directory into. More...
 
_.Library.Status GetPropertyValue (_.ZEN.Component.object pObject, _.Library.String pPropName, _.Library.String pValue)
 Internal method: get value for a given. More...
 
_.Library.String GetUserIncludeDirectory (_.Library.String pUrl)
 Return the directory in which user include files are written.
 
_.Library.Status InvalidateSchema ()
 Invalidate the XML schema information needed for StudioAssist. More...
 
_.Library.Status IsPackageInCommonDirectory (_.Library.String pPackage, _.Library.Boolean pCommon)
 Test if include files for the given class package should be placed in the common. More...
 
_.Library.Status JavaInstalled ()
 Helper method to determine whether java is installed. More...
 
 Log (_.Library.String pType, _.Library.String pClass, _.Library.String pMethod, _.Library.String pMessage, _.ZEN.Component.object pObject)
 Write information to the Zen event log. More...
 
_.Library.Boolean LoggingEnabled ()
 Test if Zen event log is enabled.
 
 ObjectToXML (_.Stream.GlobalCharacter pStream, _.ZEN.Component.object pObject, pNSList, _.Library.Integer pLevel)
 Serialize a component to XML. More...
 
_.Library.Status PageToXML (_.Stream.GlobalCharacter pStream, _.ZEN.Component.page pPage)
 Serialize a page object to an XML format compatible for. More...
 
_.Library.List ParseFormalSpec (_.Library.String pSpec)
 Parse a formal spec (used by the delegator datatype class) More...
 
_.Library.String ReadStreamIntoString (_.Library.Stream pStream, _.Library.Boolean pOverflow)
 Given a stream, read its contents into a string. More...
 
 ShowLog ()
 Write out the Zen event log to the console.
 
 StartLog ()
 Turn on the Zen event log. More...
 
 StopLog ()
 Turn off the Zen event log.
 

Additional Inherited Members

- Public Member Functions inherited from RegisteredObject
_.Library.Status OnAddToSaveSet (_.Library.Integer depth, _.Library.Integer insert, _.Library.Integer callcount)
 This callback method is invoked when the current object is added to the SaveSet,. More...
 
_.Library.Status OnClose ()
 This callback method is invoked by the <METHOD>Close</METHOD> method to. More...
 
_.Library.Status OnConstructClone (_.Library.RegisteredObject object, _.Library.Boolean deep, _.Library.String cloned)
 This callback method is invoked by the <METHOD>ConstructClone</METHOD> method to. More...
 
_.Library.Status OnNew ()
 This callback method is invoked by the <METHOD>New</METHOD> method to. More...
 
_.Library.Status OnValidateObject ()
 This callback method is invoked by the <METHOD>ValidateObject</METHOD> method to. More...
 

Detailed Description

This class contains various utility methods needed by the ZEN framework.

Member Function Documentation

◆ BrowserSupportsHTML5()

_.Library.Boolean BrowserSupportsHTML5 ( _.Library.String  pUserAgent)
staticprivate

Helper method to determine whether the UserAgent in pUserAgent

supports HTML5. If pUserAgent is not supplied and the request object exists, the value of pUserAgent defaults to request.UserAgent.

◆ FindComponentClassByName()

_.Library.String FindComponentClassByName ( _.Library.String  pNamespace,
_.Library.String  pName 
)
staticprivate

Given an xml namespace and a component name, return the class name.

of the corresponding Zen component.

◆ GenerateIncludeFiles()

_.Library.Status GenerateIncludeFiles ( _.Library.String  pPackage,
_.Library.String  pType 
)
staticprivate

Generate include files for a given Zen package.


pPackage is the package name.

◆ GenerateIncludeFilesForModules()

_.Library.Status GenerateIncludeFilesForModules ( _.Library.String  pPackage,
  pModules,
_.Library.Boolean  pAll,
_.Library.Boolean  pDisplay 
)
staticprivate

Generate include files for a given Zen package and.

list of modules.
pPackage is the package name.
pModules is a list of module names by package.
If pAll is true, then process all modules in the given package.

◆ GetLinksInPage()

GetLinksInPage ( _.Library.String  pPage,
_.Library.String  pList 
)
staticprivate

Utility method.

Return array of links within the given page class.

◆ GetPhysicalIncludeDirectory()

_.Library.String GetPhysicalIncludeDirectory ( _.Library.String  pPackage,
_.Library.Status  pStatus,
_.Library.String  pUrl 
)
staticprivate

Given a package name, return the physical directory into.

which include files should be generated.

◆ GetPropertyValue()

_.Library.Status GetPropertyValue ( _.ZEN.Component.object  pObject,
_.Library.String  pPropName,
_.Library.String  pValue 
)
staticprivate

Internal method: get value for a given.

property of a given object. If the value is the default do not set pValue.

◆ InvalidateSchema()

_.Library.Status InvalidateSchema ( )
staticprivate

Invalidate the XML schema information needed for StudioAssist.

Studio will rebuild this information when user loads a document in this namespace.

◆ IsPackageInCommonDirectory()

_.Library.Status IsPackageInCommonDirectory ( _.Library.String  pPackage,
_.Library.Boolean  pCommon 
)
staticprivate

Test if include files for the given class package should be placed in the common.

directory.

◆ JavaInstalled()

_.Library.Status JavaInstalled ( )
staticprivate

Helper method to determine whether java is installed.

Wraps ##class(Net.Remote.Service).GetJavaVersion() to provide clear error message ZenMethod wrapper is defined in ZEN.Component.abstractPage Returns a $$$OK if Java is installed

◆ Log()

Log ( _.Library.String  pType,
_.Library.String  pClass,
_.Library.String  pMethod,
_.Library.String  pMessage,
_.ZEN.Component.object  pObject 
)
staticprivate

Write information to the Zen event log.

pType is the type of event (a string such as "ERROR").
pClass is the class logging the event.
pMethod is the method logging the event.
pMessage is a message to log.
pObject, if present, is the object that is logging the event.

◆ ObjectToXML()

ObjectToXML ( _.Stream.GlobalCharacter  pStream,
_.ZEN.Component.object  pObject,
  pNSList,
_.Library.Integer  pLevel 
)
staticprivate

Serialize a component to XML.

Used by the <method>PageToXML</method> method.

◆ PageToXML()

_.Library.Status PageToXML ( _.Stream.GlobalCharacter  pStream,
_.ZEN.Component.page  pPage 
)
staticprivate

Serialize a page object to an XML format compatible for.

use within an XData Contents block.
This does not use the normal XML adaptor as it has special requirments (such as formatting and skipping properties with default values).

◆ ParseFormalSpec()

_.Library.List ParseFormalSpec ( _.Library.String  pSpec)
staticprivate

Parse a formal spec (used by the delegator datatype class)

of the form: arg:type,arg:type, and return a $list as used by the class compiler.

◆ ReadStreamIntoString()

_.Library.String ReadStreamIntoString ( _.Library.Stream  pStream,
_.Library.Boolean  pOverflow 
)
staticprivate

Given a stream, read its contents into a string.

If the stream does not fit, set pOverflow to 1.

◆ StartLog()

StartLog ( )
staticprivate

Turn on the Zen event log.

This has the side effect of clearing the event log.

◆ ConstructClassGraph()

ConstructClassGraph ( _.Library.String  pTopClass,
  pGraph,
_.Library.String  pFilter,
  pParentNode 
)
static

Create a graph of a class pTopClass and its subclasses.


pFilter limits the search candidates: only classes that start with the filter value are considered.

◆ CreateZENPageClass()

_.Library.Status CreateZENPageClass ( _.Library.String  pPage,
_.Library.String  pAppClass 
)
static

Called by wizards.

Create a new ZEN page class.

◆ DrawClassDefinition()

DrawClassDefinition ( _.Library.String  pClass)
static

Wrapper to invoke DrawClassDefinition method for a class.

[Previously private]

◆ GetCSSInfo()

_.Library.Status GetCSSInfo (   pInfo,
_.Library.String  pType 
)
static

Get CSS info from generated CSS files.

pType is "HTML" or "SVG". (ignored) Fills in array pInfo as follows:
pInfo(class,style) = comment

◆ GetComponentAttrs()

_.Library.Boolean GetComponentAttrs ( _.Library.String  comp,
  attrs,
  cats 
)
static

Get list of attributes used by ZEN component comp.


Returns true if the component is defined.

◆ IsComponentEmpty()

_.Library.Boolean IsComponentEmpty ( _.Library.String  pClass)
static

Determine if component class uses an empty XML element.

(i.e., does not have child elements).

◆ ParseCSS()

ParseCSS ( _.Library.String  pText,
  pParse 
)
static

Utility method to parse a string, pText, containing one or more.

CSS declarations. Returns an array of parsed declarations in the form:
pParse(n) = $LB(prop,val)

◆ ParseCSSFile()

_.Library.Status ParseCSSFile ( _.Library.String  pFileName,
  pInfo 
)
static

Utility method.

Opens CSS file, pFileName, and finds all the

CSS declarations in it. Fills in array pInfo as follows:
pInfo(class,style) = comment

◆ WriteCSSForComponent()

_.Library.Status WriteCSSForComponent ( _.Library.String  pClassName,
_.Library.String  pStyleBlock 
)
static

Write out the contents of the default CSS Style sheet for.

a component.
This is used when pre-building a .css file for a package. pStyleBlock is the name of the XData block containing the CSS style definition.

◆ WriteIncludeFilesForModule()

_.Library.Status WriteIncludeFilesForModule ( _.Library.String  pDirectory,
_.Library.String  pModule,
  pWorkList,
_.Library.String  pFlags 
)
static

Utility method to write out JS and CSS Style Sheet files.

for classes within a given module (contained in pWorkList.
If pFlags contains "-d", then no output is written. If pFlags contains "-s", then output is not stripped.