PATH Documentation > WebObjects

Up

DefaultAssignment

Package: com.webobjects.directtoweb

Inherits from:Assignment


Class Description

This class provides several methods that provide default values for the right-hand sides of rules. Many of these default values depend on the current entity or property in the Direct to Web context that is active when the rule fires.

DefaultAssignment is also a convenient class to subclass if you want to add your own assignment methods. To do so, subclass DefaultAssignment and add the method. Any rule that uses the method must have its right-hand-side value set to the name of the method. Use the _context variable to access the Direct to Web context that is active when the rule fires.

For more information about subclassing DefaultAssignment, see the "Customizing a Direct to Web Application" chapter of Developing WebObjects Applications with Direct to Web.

Method Types


Constructors

Firing the Rule
Private Methods
Providing Default Values


Constructors


DefaultAssignment

public DefaultAssignment(String keyPath, String value)

Creates a DefaultAssignment object and sets its key path and value.

DefaultAssignment

public DefaultAssignment(EOKeyValueUnarchiver unarchiver)

Creates a DefaultAssignment object based on a EOKeyValueUnarchiver object. You use this constructor to read the assignment information from a rule file.
Methods


attributeWidth

public int attributeWidth()

This method is intentionally undocumented. You should never have to invoke or customize it.



defaultDisplayNameForProperty

public String defaultDisplayNameForProperty()

Returns a String containing a user-presentable version of the current property key in the Direct to Web context in which the receiver's rule fires. This string is formed by capitalizing the key and inserting spaces between words with mixed case.



defaultEntityName

public String defaultEntityName()

Returns the first entity name in the NSArray returned by smartDefaultEntityNames.

See Also:
smartDefaultEntityNames



defaultPropertyKeysFromEntity

public NSArray defaultPropertyKeysFromEntity()

Returns a sorted NSArray containing the property keys for the current entity excluding primary and foreign keys.



defaultPropertyKeysFromEntityWithoutRelationships

public NSArray defaultPropertyKeysFromEntityWithoutRelationships()

Returns a sorted NSArray containing the property keys for the current entity excluding relationships, primary keys, and foreign keys.



fire

public synchronized Object fire(D2WContext context)

This method is invoked when the receiver's rule fires. In turn, it invokes the method in this class specified by the receiver's right-hand-side value.



isEntityReadOnly

public Integer isEntityReadOnly()

Returns whether or not the current entity (in the Direct to Web context in which the receiver's rule fires) can be modified. You can specify if an entity can be modified using the Web Assistant. See the "Direct to Web" chapter of WebObjects Tools and Techniques for more details.

You can override this method to provide your own criteria for whether or not a entity can be modified.



smartDefaultAttributeWidth

final public String smartDefaultAttributeWidth()

Returns a String containing the result of smartDefaultAttributeWidthAsInt.

See Also:
smartDefaultAttributeWidthAsInt



smartDefaultAttributeWidthAsInt

public int smartDefaultAttributeWidthAsInt()

Returns the width of the current attribute in the Direct to Web context in which the receiver's rule fires. Returns 50 if the width of the current attribute is less than 50. Returns 20 if the current property is not an attribute.



smartDefaultEntityNames

public final NSArray smartDefaultEntityNames()

Returns a sorted NSArray containing the names of the entities in the application. Entities having fewer than three relationships and no attributes are assumed to be join tables and are excluded.



smartDefaultKey

public String smartDefaultKey()

Returns the key for the default property of the current entity in the Direct to Web context in which the receiver's rule fires. This method guesses the most likely property with which the user will query for the entity and returns its key.



smartDefaultKeyWhenRelationship

public String smartDefaultKeyWhenRelationship()

Returns a key for the default property of the current relationship's destination object. If the current property (in the Direct to Web context in which the receiver's rule fires) is not a relationship, returns null. This method guesses the most likely property with which the user will query for the relationship's destination entity and returns its key.



smartDefaultRows

final public String smartDefaultRows()

Returns a String containing an estimate of the number of rows that a WOText element would need to display the current attribute.



valueString

public String valueString()

This method is intentionally undocumented. You should never have to invoke or customize it.



© 2001 Apple Computer, Inc.