Oculus Layout Builder Plugin API Documentation
November 25, 2002

com.oculustech.layoutbuilder.pluginapi
Class FieldInfo

java.lang.Object
  |
  +--com.oculustech.layoutbuilder.pluginapi.FieldInfo

public abstract class FieldInfo
extends java.lang.Object

An instance of this class represents the meta-information of a field associated with a component. It determines how that field appears in the inspector, and gives the information via which the field may be stringified and unstringified when being saved out or restored.


Field Summary
static java.lang.String CK_CHECK_BOX
          Control kind constant.
static java.lang.String CK_COLOR_DROPDOWN
          Control kind constant.
static java.lang.String CK_DROPDOWN
          Control kind constant.
static java.lang.String CK_EDITOR_PANE
          Control kind constant.
static java.lang.String CK_FONT_CHOOSER
          Control kind constant.
static java.lang.String CK_RADIO
          Control kind constant.
static java.lang.String CK_STRING_LIST_EDIT
          Control kind constant.
static java.lang.String CK_TEXT_FIELD
          Control kind constant.
static java.lang.String CO_FORMAT
          Control Option Map key.
static java.lang.String CO_OPTION_LABELS
          Control Option Map key.
static java.lang.String CO_OPTION_VALUES
          Control Option Map key.
static java.lang.String CO_TOOLTIP
          Control Option Map key.
protected  java.lang.String controlKind
           
protected  java.util.Map controlProperties
           
protected  java.lang.String fieldName
           
protected  boolean isXMLAttributeCompatible
           
protected  java.lang.String label
           
protected  java.lang.String pageName
           
protected  java.lang.String sectionName
           
protected  java.lang.String sortKey
           
 
Constructor Summary
protected FieldInfo()
           
 
Method Summary
 java.lang.String getControlKind()
          Return the kind of control to use for this field.
 java.util.Map getControlProperties()
          Return the properties map for this field.
 java.lang.String getFieldName()
          Return the logical name of this field.
 boolean getIsXMLAttributeCompatible()
          Returns true if this field's value is suitable for encoding as an XML tag attribute, or false if this value should be stored as the textual data of the tag
 java.lang.String getJavaCodeValue()
          Get the literal to be used in the generated Java code to represent the value of this field.
static java.lang.String getJavaCodeValue(java.lang.String stringLiteral)
          Returns the given string wrapped in double-quotes, with all backslashes, double-quotes, and newlines it contains escaped out, making it an appropriate java string literal.
static java.lang.String getJavaCodeValueForColor(java.awt.Color c)
          Returns a String representing the code value of the argument c.
static java.lang.String getJavaIdentifierValue(java.lang.String stringLiteral)
          Returns the given string with characters not allowed in Java identifiers (variable names) replaced with underscores.
 java.lang.String getLabel()
          Return the label for this field in the inspector
 java.lang.String getPageName()
          Return the name of the page (tab) onto which to place this field
 java.lang.String getSectionName()
          Return the name of the section within the page into which to place this field.
 java.lang.String getSortKey()
          Returns the sort key that determines the order in which this component appears within its section.
abstract  java.lang.String getStringifiedValue()
          Get the value as a string such that it can be set with setValueFromString().
abstract  java.lang.Object getValue()
          Get the value of this field
abstract  java.lang.Class getValueTypeClass()
          Get the Class representing the type of value of this field (i.e., all possible return values of getValue() must be an instance of this class or one of its subclasses.
abstract  boolean isDefaultValue()
          Returns true iff the value of this field is the default value that would automatically be assumed for a new instance of this component (and hence doesn't have to be explicitly set in the generated code)
abstract  void setValue(java.lang.Object v)
          Set the value of this field
abstract  void setValueFromString(java.lang.String v)
          Set the value of this field from a stringified form returned by getStringifiedValue()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CK_TEXT_FIELD

public static final java.lang.String CK_TEXT_FIELD
Control kind constant. Text fields can edit instances of String and Number.

CK_FONT_CHOOSER

public static final java.lang.String CK_FONT_CHOOSER
Control kind constant. Font choosers edit instances of Font.

CK_COLOR_DROPDOWN

public static final java.lang.String CK_COLOR_DROPDOWN
Control kind constant. Color choosers edit instances of Color.

CK_EDITOR_PANE

public static final java.lang.String CK_EDITOR_PANE
Control kind constant. Editor panes edit Strings.

CK_CHECK_BOX

public static final java.lang.String CK_CHECK_BOX
Control kind constant. Checkboxes edit booleans.

CK_DROPDOWN

public static final java.lang.String CK_DROPDOWN
Control kind constant. Dropdowns can edit any type of value. See CO_OPTION_LABELS and CO_OPTION_VALUES for more information.

CK_RADIO

public static final java.lang.String CK_RADIO
Control kind constant. Radio buttons can edit any type of value. See CO_OPTION_LABELS and CO_OPTION_VALUES for more information.

CK_STRING_LIST_EDIT

public static final java.lang.String CK_STRING_LIST_EDIT
Control kind constant. Edits a String[].

CO_OPTION_LABELS

public static final java.lang.String CO_OPTION_LABELS
Control Option Map key. Value is String []. A list of user-displayable options to choose from for choosable values (radio buttons, drop-downs, etc.). If different values should actually be written to dataField, also set OPTION_VALUES. If type is int and CO_OPTION_VALUES isn't set, index of item chosen will be written to dataField.

CO_OPTION_VALUES

public static final java.lang.String CO_OPTION_VALUES
Control Option Map key. Value is String []. A list of values to put into dataField corresponding to valueOptions user-readable labels. (If null, labels themselves are used as values.)

CO_TOOLTIP

public static final java.lang.String CO_TOOLTIP
Control Option Map key. Value is String. Specifies tooltip.

CO_FORMAT

public static final java.lang.String CO_FORMAT
Control Option Map key. Value is a java.text.Format. Used to turn object into display string, and then to reparse display string. If a MessageFormat object is used, it should have exactly one parameter.

fieldName

protected java.lang.String fieldName

label

protected java.lang.String label

controlKind

protected java.lang.String controlKind

controlProperties

protected java.util.Map controlProperties

pageName

protected java.lang.String pageName

sectionName

protected java.lang.String sectionName

sortKey

protected java.lang.String sortKey

isXMLAttributeCompatible

protected boolean isXMLAttributeCompatible
Constructor Detail

FieldInfo

protected FieldInfo()
Method Detail

getFieldName

public java.lang.String getFieldName()
Return the logical name of this field. This must be unique among all the fields of this component.

getLabel

public java.lang.String getLabel()
Return the label for this field in the inspector

getControlKind

public java.lang.String getControlKind()
Return the kind of control to use for this field. Must be one of constants beginning with "CK_".

getControlProperties

public java.util.Map getControlProperties()
Return the properties map for this field. Properties determine specifics of how a given control is configured (tooltips, dropdown options, etc.). Map keys must be one of constants beginning with "CO_". Map values should be as specified for given key constant.

getPageName

public java.lang.String getPageName()
Return the name of the page (tab) onto which to place this field

getSectionName

public java.lang.String getSectionName()
Return the name of the section within the page into which to place this field. Returns null for default section.

getSortKey

public java.lang.String getSortKey()
Returns the sort key that determines the order in which this component appears within its section.

getIsXMLAttributeCompatible

public boolean getIsXMLAttributeCompatible()
Returns true if this field's value is suitable for encoding as an XML tag attribute, or false if this value should be stored as the textual data of the tag

getValue

public abstract java.lang.Object getValue()
Get the value of this field

setValue

public abstract void setValue(java.lang.Object v)
Set the value of this field

getStringifiedValue

public abstract java.lang.String getStringifiedValue()
Get the value as a string such that it can be set with setValueFromString().

getJavaCodeValue

public static java.lang.String getJavaCodeValue(java.lang.String stringLiteral)
Returns the given string wrapped in double-quotes, with all backslashes, double-quotes, and newlines it contains escaped out, making it an appropriate java string literal.

getJavaIdentifierValue

public static java.lang.String getJavaIdentifierValue(java.lang.String stringLiteral)
Returns the given string with characters not allowed in Java identifiers (variable names) replaced with underscores.

getJavaCodeValue

public java.lang.String getJavaCodeValue()
Get the literal to be used in the generated Java code to represent the value of this field. Strings should include quotes with necessary escapes, Colors should be constants (Color.black) or calls to the Color constructor, etc.

Default implementation handles primitive types, Colors, Fonts and Strings. It is assumed that Number, Boolean and Character instances can be rendered as their primitive type (int, double, etc.) rather than their object type.


getJavaCodeValueForColor

public static java.lang.String getJavaCodeValueForColor(java.awt.Color c)
Returns a String representing the code value of the argument c. Uses static fields in the Color class when appropriate.

setValueFromString

public abstract void setValueFromString(java.lang.String v)
Set the value of this field from a stringified form returned by getStringifiedValue()

getValueTypeClass

public abstract java.lang.Class getValueTypeClass()
Get the Class representing the type of value of this field (i.e., all possible return values of getValue() must be an instance of this class or one of its subclasses.

isDefaultValue

public abstract boolean isDefaultValue()
Returns true iff the value of this field is the default value that would automatically be assumed for a new instance of this component (and hence doesn't have to be explicitly set in the generated code)

Oculus Layout Builder Plugin API Documentation
November 25, 2002

Copyright 2002 Oculus Technologies Corporation. 103 Broad Street, 6th Floor,
Boston, Massachusetts, 02110, U.S.A. All Rights Reserved.