Direct to Web Context Keys
Introduction
This document describes the keys that can be accessed with the D2WContextvalueForKey
and takeValueForKey
methods. When you access a Direct to Web context key in a Direct to Web template's bindings (.wod
) file, for example,size = d2wContext.size;
WebObjects indirectly invokes
valueForKey("size")
on the d2wContext
Direct to Web context. When a bindings file has the entry:value = d2wContext.entity.name;
WebObjects indirectly invokes
valueForKeyPath("entity.name")
on the d2wContext
Direct to Web context.
Each key has a type, to which you need to cast the result of valueForKey
.
For example, to get the current entity in a Direct to Web context called myContext
use:
currentEntity = (EOEntity)myContext.valueForKey("entity");
Likewise, for
valueForKeyPath
you use:currentEntityName = (String)myContext.valueForKeyPath("entity.name");
In addition to specifying the type, the key descriptions below also indicate where the key appears in a rule. Keys labeled "Rule's key" are resolved using rules. There are two sets of rules: the rules managed by the Web Assistant (in the user.d2wmodel
file in your project's Resources suitcase) and the default rules in the Direct to Web Framework (in $(NEXT_ROOT)/Library/Frameworks/DirectToWeb.framework/Resources/d2w.d2wmodel
).
Keys labeled "Rule's condition" only appear in the conditions (left hand side) of rules. These keys and their values are stored in the Direct to Web context's state dictionary. Three of these keys can be modified using the takeValueForKey
method: task
, entity
, and propertyKey
. The other keys that appear in the rule's condition are computed when propertyKey
is modified. Refer to the "Direct to Web Architecture" chapter of Developing WebObjects Applications With Direct to Web for more information about how the Direct to Web context resolves its keys.
The following keys are defined by the Direct to Web context:
- allowCollapsing
- alternateRowColor
- attribute
- backgroundColorForPage
- backgroundColorForTable
- bannerFileName
- batchSize
- bold
- border
- color
- colorForLine
- columnCount
- componentAvailable
- componentBorder
- componentName
- customComponentName
- disabled
- displayNameForProperty
- displayPropertyKeys
- editIcon
- entity
- formatter
- framesActive
- framework
- inspectComponentName
- inspectIcon
- isDeep
- italic
- justification
- keyWhenRelationship
- length
- numCols
- pageAvailable
- pageName
- pageWrapperName
- propertyIsKeyPath
- propertyKey
- propertyType
- readOnly
- readOnlyEntityNames
- refreshRefetchedObjects
- relationship
- rows
- selectButtonFileName
- showBanner
- size
- startupEntityName
- startupTask
- subtask
- tabContents
- tableWidth
- tabName
- tabs
- target
- task
- threshold
- uiStyle
- usesDistinct
- visibleEntityNames
- webAssistantPageName
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 if the current property level components can be collapsed and a value of 0 otherwise. This flag is primarily used by the display and edit components for relationships.
alternateRowColor
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 if the list page displays its entries with alternating row colors and a value of zero otherwise. This flag is used by some list page Direct to Web templates.
attribute
- Type:
EOAttribute
- Appears: Rule's condition (left-hand side)
- The receiver's current attribute. Resolves to
null
if the current property is not an attribute. The value for this key is derived frompropertyKey
.
backgroundColorForPage
- Type:
String
- Appears: Rule's key (right-hand side)
- The HTML background color for the page containing the receiver. Used by the D2WCompactInspectComponent.
backgroundColorForTable
- Type:
String
- Appears: Rule's key (right-hand side)
- The background color for the table on page containing the receiver.
bannerFileName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the file depicting the banner displayed at the top of a Direct to Web page or a Direct to Web reusable component.
batchSize
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The number of objects per batch displayed on a list page. This key is used by the list and plain-list page Direct to Web templates.
bold
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 if the text is displayed in bold face and a value of 0 otherwise. This key is used by the styled display property-level components: D2WDisplayStyledDate, D2WDisplayedStyledNumber, D2WDisplayStyledString, and D2WKeyPathContainer.
border
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The width of the border around the main table displayed in the page. This key is used by the Basic look Direct to Web templates containing tables: BASInspectPage, BASListPage, BASPlainListPage, BASQueryAllEntitiesPage, and BASQueryPage.
color
- Type:
String
- Appears: Rule's key (right-hand side)
- The color used to display the attribute. This key is used by the styled display property-level components: D2WDisplayStyledDate, D2WDisplayStyledNumber, and D2WDisplayStyledString. It is also used by the D2WKeyPathContaininer property-level component.
colorForLine
- Type:
String
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
columnCount
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The maximum number of columns in the table that displays the listed objects. This key is used by the plain-list page Direct to Web templates: BASPlainListPage, NEUPlainListPage, and WOLPlainListPage.
componentAvailable
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of a property-level component that can be used to display a property. The Web Assistant asks the rule system for all rules that can fire for this key to determine which property-level components can be used to display a property.
componentBorder
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The width of the border around the table displayed in the property-level component. This key is used by the D2WDisplayToManyTable and D2WKeyPathContainer property-level components.
componentName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of a property-level component that can be used to display a particular property for a particular task and entity. This key is used by the Direct to Web templates.
customComponentName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of a custom WOComponent defined in your project. This key is used by the D2WCustomComponent and D2WCustomQueryComponent property-level components.
disabled
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has value of 1 when the current property-level component's hyperlink is disabled and a value of 0 otherwise. This key is used by the D2WDisplayToManyTable, D2WDisplayToOne, D2WEditToOneFault, and D2WKeyPathContainer property-level components.
displayNameForProperty
- Type:
String
- Appears: Rule's key (right-hand side)
- A String containing a representation of the current property's name that is suitable for displaying in a user interface.
displayPropertyKeys
- Type:
NSArray
- Appears: Rule's key (right-hand side)
- An array of keys for the properties that are visible on the page for the receiver's current task and entity. A Direct to Web template that displays the properties of an entity usually iterates through this list. You can change the visible properties on a page using the Web Assistant.
editIcon
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the file depicting an icon the user clicks to edit a relationship. The file must be in your project's WebServerResources suitcase. This key is used by the D2WEditToManyFault and the D2WEditToOneFault property-level components.
entity
- Type:
EOEntity
- Appears: Rule's condition (left-hand side)
- The receiver's current entity, stored in the receiver's state dictionary. The value for this key is set by the Direct to Web factory when it creates a new Direct to Web page.
formatter
- Type:
String
- Appears: Rule's key (right-hand side)
- A string containing a format specification. This key is used by the number and date property-level components. It is also used by the D2WEditString and D2WQueryStringComponent property-level components.
framesActive
- Type:
Integer
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
framework
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the framework containing the image displayed by the D2WDisplayImageFromPath property level component. Defaults to "app" for images in your application.
inspectComponentName
- Type:
String
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
inspectIcon
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the file depicting an icon the user clicks to inspect a relationship. The file must be in your project's WebServerResources suitcase. This key is used by the D2WEditToManyFault and the D2WEditToOneFault property-level components.
isDeep
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when fetches should include sub-entities of the fetch specification's entity. Defaults to 0. This key is used by the fetch specifications for query pages.
italic
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when text is displayed in italics and a value of 0 otherwise. This key is used by the styled display property-level components: D2WDisplayStyledDate, D2WDisplayedStyledNumber, D2WDisplayStyledString, and D2WKeyPathContainer.
justification
- Type:
String
- Appears: Rule's key (right-hand side)
- A flag indicating whether or not the text is justified. This key is used by the list page Direct to Web templates: BASListPage, NEUListPage, and WOLListPage.
keyWhenRelationship
- Type:
String
- Appears: Rule's key (right-hand side)
- When the receiver's current property is a relationship, the value for this key is the key for a property of the destination entity that identifies the entity. For example, if the receiver's current entity is
Movie
and the current property is thetoStudio
relationship, the destination entity isStudio
. An appropriate value forkeyWhenRelationship
isname
since thename
property identifies the studio.
length
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The size of the field used to display a property.
numCols
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The number of columns in the table of checkboxes or radio buttons used to display the destination objects of a relationship. This key is used by the D2WDisplayToManyTable, D2WEditToManyRelationship, D2WEditToOneRelationship, D2WKeyPathContainer, D2WQueryToManyRelationship, and D2WQueryToOneRelationship property-level components.
pageAvailable
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of a Direct to Web template that can be used to display a page. The Web Assistant asks the rule system for all rules that can fire for this key to determine which Direct to Web templates can be used to display a page. See the "Customizing A Direct to Web Application" chapter of Developing WebObjects Applications With Direct to Web for an example of how to create a rule for this key.
pageName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the Direct to Web template used to display a page. Used by the Direct to Web factory when creating new pages.
pageWrapperName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the page wrapper WOComponent in which the Direct to Web page appears. Defaults to "PageWrapper". If you did not use the Direct to Web wizard to create your project, you should create a component called PageWrapper.wo and add it to your project.
propertyIsKeyPath
- Type:
Integer
- Appears: Rule's condition (left-hand side)
- A flag that has a value of 1 when the receiver's current property is a key path and a value of 0 otherwise. The value for this key is derived from
propertyKey
.
propertyKey
- Type:
String
- Appears: Rule's condition (left-hand side)
- A String containing the key for the receiver's current property. When the the value for this key is set, the values for the
attribute
,propertyIsKeyPath
,propertyType
, andrelationship
keys are derived from it. The value for this key is stored in the receiver's state dictionary.
propertyType
- Type:
String
- Appears: Rule's condition (left-hand side)
- A String representing the type of the receiver's current property. Resolves to "r" if the property is a relationship, "a" if the property is an attribute, "c" if the property is a custom property, and "k" if the property is a key path. The value for this key is derived from
propertyKey
.
readOnly
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when the receiver's current entity cannot be modified and a value of 0 otherwise. You can change which entites are read-only using the Web Assistant.
readOnlyEntityNames
- Type:
NSArray
- Appears: Rule's key (right-hand side)
- An array of entity names that are read-only. You can change which entities are read-only using the Web Assistant.
refreshRefetchedObjects
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when existing objects are overwritten with fetched values when they've been updated or changed. If the flag's value is 0 (the default), existing objects aren't touched when their data is refetched (the fetched data is simply discarded). This key is used by the fetch specifications for query pages.
relationship
- Type:
EORelationship
- Appears: Rule's condition (left-hand side)
- The receiver's current relationship. Resolves to
null
if the current property is not a relationship. The value for this key is derived frompropertyKey
.
rows
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The number of rows in the D2WDisplayLargeString and D2WEditLargeString property-level components. The value for this key is passed to the ROWS attribute of the component's TEXTAREA tag.
selectButtonFileName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the file depicting the an icon the user clicks to select a record in a select component. The file must be in your project's WebServerResources suitcase. This key is used by the BASListPage and WOLListPage Direct to Web templates.
showBanner
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when the banner should be displayed by a Direct to Web template and a value of 0 otherwise. This key is useful if you embed a Direct to Web reusable component in one of your pages and find that the banner is too big or unattractive in the page.
size
- Type:
Integer
- Appears: Rule's key (right-hand side)
- The number of rows in the browsers displayed by some of the relationship property-level components. Defaults to 8.
startupEntityName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of entity used on startup page. Since the startup page is a query-all page by default, this key is not used in a Direct to Web application generated by the wizard. If you change the default startup task (see
startupTask
) to one that requires an entity, use this key.
startupTask
- Type:
String
- Appears: Rule's key (right-hand side)
- The startup page task. Defaults to "queryAll". If you override this default and specify a task that requires an entity, you need to specify the value for the
startupEntityName
key.
subtask
- Type:
String
- Appears: Rule's condition (left-hand side)
- This key is private. You should never need to get or set the value for it.
tabContents
- Type:
String
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
tableWidth
- Type:
Number
- Appears: Rule's key (right-hand side)
- The width of the tab panel. This key is used by the NEUTabInspectPage and the WOLTabInspectPage Direct to Web templates.
tabName
- Type:
String
- Appears: Rule's key (right-hand side)
- The name of the tab (in a tab-inspect page) the receiver's current property is in. To specify which properties appear in tab called
myTab
, you need to write rules that specify the properties for whichtabName=myTab
.
tabs
- Type:
NSArray
- Appears: Rule's key (right-hand side)
- An array containing the tab names.
target
- Type:
String
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
task
- Type:
String
- Appears: Rule's condition (left-hand side)
- The receiver's current task, stored in the receiver's state dictionary. The value for this key is set by the Direct to Web factory when it creates a new Direct to Web page.
threshold
- Type:
Integer
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
uiStyle
- Type:
String
- Appears: Rule's key (right-hand side)
- The user interface style used by the certain relationship property-level components. For the D2WEditToOneRelationship and D2WQueryToOneRelationship components, the value can be "browser", "popup", or "radio". For the D2WEditToManyRelationship and D2WQueryToManyRelationship components, the value can be "browser", or "checkbox"
usesDistinct
- Type:
Integer
- Appears: Rule's key (right-hand side)
- A flag that has a value of 1 when duplicate objects or records are removed after fetching. Defaults to 0. This key is used by the fetch specifications for query pages.
visibleEntityNames
- Type:
NSArray
- Appears: Rule's key (right-hand side)
- An array of entities that appear in the application. These entities can be read-only or not. You can set which entities appear in your application using the Web Assistant.
webAssistantPageName
- Type:
String
- Appears: Rule's key (right-hand side)
- This key is private. You should never need to get or set the value for it.
© 2001 Apple Computer, Inc.