Packagecom.adobe.portfolio.utils
Classpublic class FieldUtils
InheritanceFieldUtils Inheritance Object

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The FieldUtils class provides a set of utility functions for setting and getting attachment field values.



Public Methods
 MethodDefined By
  
Empty constructor
FieldUtils
  
[static] Get the attachment's property name, given the field.
FieldUtils
  
getDisplayNameByField(field:IField, includeColon:Boolean = false):String
[static] Get the display name of the field.
FieldUtils
  
getDisplayNameByFieldName(fields:Array, fieldName:String, includeColon:Boolean = false):String
[static] Get the display name of the field, given its field name.
FieldUtils
  
getFieldByFieldName(fields:Array, fieldName:String, allowFallback:Boolean = true):IField
[static] Get the field, given its field name.
FieldUtils
  
getFieldOrPropertyValue(item:IAttachment, field:IField, prop:String):*
[static] Get the field value for the given attachment, and the field or its property.
FieldUtils
  
[static] Get the field value for the given attachment and field.
FieldUtils
  
[static] Get the styled version of the field value.
FieldUtils
  
getTextFromField(attachment:IAttachment, field:IField, dateStyle:String, timeStyle:String):String
[static] Get field value as text from the given field
FieldUtils
  
[static] Determines if a given field belongs to one of the default fields.
FieldUtils
  
isUserDefinedField(field:IField):Boolean
[static] Determines if a given field is a user defined field.
FieldUtils
  
setFieldDisplayNameFromText(collection:ICollection, fieldName:String, displayName:String):Boolean
[static] Give a new display name to a user defined field.
FieldUtils
  
setFieldFromText(attachment:IAttachment, field:IField, fieldText:String):Boolean
[static] Sets the given text as the field value.
FieldUtils
  
setFieldValue(item:IAttachment, field:IField, value:*):void
[static] setFieldValue sets the value of the given feld and attachment.
FieldUtils
Public Constants
 ConstantDefined By
  DISPLAY_NAME_FIELD_NAME : String = adobe:DisplayName
[static] The string literal used for the field name of the field, "Display Name".
FieldUtils
  TAGS_FIELD_NAME : String = adobe:Tags
[static] The string literal used for the field name of the field, "Tags".
FieldUtils
Constructor Detail
FieldUtils()Constructor
public function FieldUtils()

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Empty constructor

Method Detail
getAttachmentPropertyName()method
public static function getAttachmentPropertyName(field:IField):String

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the attachment's property name, given the field.

Parameters

field:IField — The field whose property name needs to be retrieved.

Returns
String — The property name for the given field
getDisplayNameByField()method 
public static function getDisplayNameByField(field:IField, includeColon:Boolean = false):String

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the display name of the field.

Parameters

field:IField — The field whose display name is to be retrieved,
 
includeColon:Boolean (default = false) — When true, use the localized string to determine where the colon should be.

Returns
String — The display name of the given field Example: Field with the field name "adobe:Tags" has the display name "Tags"
getDisplayNameByFieldName()method 
public static function getDisplayNameByFieldName(fields:Array, fieldName:String, includeColon:Boolean = false):String

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the display name of the field, given its field name.

Parameters

fields:Array — The array of fields that contains the field.
 
fieldName:String — The name of the field whose display name is to be retrieved,
 
includeColon:Boolean (default = false) — When true, use the localized string to determine where the colon should be.

Returns
String — The display name of the given field Example: Field with the field name "adobe:Tags" has the display name "Tags"
getFieldByFieldName()method 
public static function getFieldByFieldName(fields:Array, fieldName:String, allowFallback:Boolean = true):IField

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the field, given its field name.

Parameters

fields:Array — The array of fields that contains the field.
 
fieldName:String — The name of the field that is to be retrieved,
 
allowFallback:Boolean (default = true) — When true, fallback to filename or to one of the built-in field types.

Returns
IField — The field with the given name.
getFieldOrPropertyValue()method 
public static function getFieldOrPropertyValue(item:IAttachment, field:IField, prop:String):*

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the field value for the given attachment, and the field or its property. If the field is specified, the property string literal is ignored. If the field is null, the property is used to obtain the field value.

Parameters

item:IAttachment — The attachment whose field or property value is to be retrieved.
 
field:IField — The field whose value is to be retrieved.
 
prop:String — The string literal representing the field property.

Returns
* — The field value for the given attachment and field or property.
getFieldValue()method 
public static function getFieldValue(item:IAttachment, field:IField):*

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the field value for the given attachment and field.

Parameters

item:IAttachment — The attachment whose field value is to be retrieved.
 
field:IField — The field whose value is to be retrieved.

Returns
* — The field value for the given attachment and field.
getStyledTextFromField()method 
public static function getStyledTextFromField(attachment:IAttachment, field:IField):XML

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get the styled version of the field value.

Parameters

attachment:IAttachment — The attachment whose field value needs to be retrieved.
 
field:IField — The field whose value needs to be retrieved as stylized text.

Returns
XML — The field value as stylized text.
getTextFromField()method 
public static function getTextFromField(attachment:IAttachment, field:IField, dateStyle:String, timeStyle:String):String

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Get field value as text from the given field

Parameters

attachment:IAttachment — The attachment whose field value needs to be retrieved.
 
field:IField — The field whose value needs to be retrieved.
 
dateStyle:String — Specifies the style to use when formatting dates. The default is DateTimeStyle.SHORT.
 
timeStyle:String — Specifies the style to use when formatting times. The default is DateTimeStyle.MEDIUM.

Returns
String — the field value as text formatted according to the given styles.
isPropertyOfAttachment()method 
public static function isPropertyOfAttachment(field:IField):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines if a given field belongs to one of the default fields. You must use property notation for the default fields instead of using the getFieldValue/setFieldValue notation. This also includes icon since that is also a property that is put in grids.

Parameters

field:IField

Returns
Boolean
isUserDefinedField()method 
public static function isUserDefinedField(field:IField):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Determines if a given field is a user defined field. This is just the opposite of isPropertyOfAttachment.

Parameters

field:IField

Returns
Boolean
setFieldDisplayNameFromText()method 
public static function setFieldDisplayNameFromText(collection:ICollection, fieldName:String, displayName:String):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Give a new display name to a user defined field.

Parameters

collection:ICollection — The collection containing the field
 
fieldName:String — The name of the field whose display name needs to be set.
 
displayName:String — The new display name.

Returns
Boolean — True if the display name is successfully set.
setFieldFromText()method 
public static function setFieldFromText(attachment:IAttachment, field:IField, fieldText:String):Boolean

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

Sets the given text as the field value.

Parameters

attachment:IAttachment — The attachment whose field value needs to be set.
 
field:IField — The field whose value needs to be set
 
fieldText:String — The text to be set.

Returns
Boolean — True if the field value is successfully set.
setFieldValue()method 
public static function setFieldValue(item:IAttachment, field:IField, value:*):void

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

setFieldValue sets the value of the given feld and attachment.

Parameters

item:IAttachment — The attachment whose field value is to be set
 
field:IField — The field whose value is to be set.
 
value:* — The value to be set.

Constant Detail
DISPLAY_NAME_FIELD_NAMEConstant
public static const DISPLAY_NAME_FIELD_NAME:String = adobe:DisplayName

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The string literal used for the field name of the field, "Display Name". This is different from the string that is used in the UI to display this field.

TAGS_FIELD_NAMEConstant 
public static const TAGS_FIELD_NAME:String = adobe:Tags

Language Version : ActionScript 3.0
Product Version : Portfolio 10.0
Runtime Versions : Flash Player 10.1, AIR 2.0

The string literal used for the field name of the field, "Tags". This is different from the string that is used in the UI to display this field.