Oculus Layout Builder Plugin API Documentation
November 25, 2002

com.oculustech.layoutbuilder.pluginapi
Interface ComponentMetaInfo

All Known Implementing Classes:
AbstractComponentMetaInfo

public interface ComponentMetaInfo

An instance of this interface provides the meta-interface necessary for the builder to interact with a given component. The builder requires one unique instance of this interface per component instance (not one per component kind!).


Method Summary
 boolean canInlineConstruction()
          Return true iif it is OK to inline the construction of this component in the add() call.
 java.lang.String[] defaultInspectorFieldsToExclude()
          Returns the set of fields that should be excluded when fields are automatically generated by reflection.
 boolean doIncludeDefaultInspectorFields()
          If this returns true, the system will automatically generate fields in the inspector by reflecting on the component's class.
 java.lang.String generateCode(java.lang.String variableName, boolean asInlinedInstance, boolean asLocalVariable)
          Generate code for this component.
 java.lang.String generateDeclaration(java.lang.String variableName)
          This should generate a class declaration for this component.
 java.awt.Component getComponent()
          Return the component corresponding to this metainfo instance.
 FieldInfo[] getFields()
          Return information on the fields that should be presented in the inspector for this component type.
 

Method Detail

getFields

public FieldInfo[] getFields()
Return information on the fields that should be presented in the inspector for this component type. This can return null or an empty list if doIncludeDefaultInspectorFields() returns true (in which case the system will generate default inspector fields automatically by inspecting the component class).

canInlineConstruction

public boolean canInlineConstruction()
Return true iif it is OK to inline the construction of this component in the add() call. This results in more compact code, but makes it impossible to call side-effecting methods (setXXX) on the component.

generateDeclaration

public java.lang.String generateDeclaration(java.lang.String variableName)
This should generate a class declaration for this component. It should include type and variable name only; it should not include modifiers (private, static, final), nor should it initialize the variable. It should include a final semicolon (e.g. "MyComponentClass variableName;")

generateCode

public java.lang.String generateCode(java.lang.String variableName,
                                     boolean asInlinedInstance,
                                     boolean asLocalVariable)
Generate code for this component. If asInlinedInstance is true, then this should be a constructor/factory call only, which can be nested directly into an add(Component) call. asInlinedInstance will only be true if canInlineConstruction() returns true. If asLocalVariable is true, code should include variable declarator when initializing variable name; otherwise, variable was already declared as class variable, and code should not include declarator.

getComponent

public java.awt.Component getComponent()
Return the component corresponding to this metainfo instance.

doIncludeDefaultInspectorFields

public boolean doIncludeDefaultInspectorFields()
If this returns true, the system will automatically generate fields in the inspector by reflecting on the component's class. These fields will be used in addition to any defined by getFields(). defaultInspectorFieldsToExclude() can be used to exclude any of these fields from being automatically generated. Generated fields will be used in addition to any returned by getFields().

defaultInspectorFieldsToExclude

public java.lang.String[] defaultInspectorFieldsToExclude()
Returns the set of fields that should be excluded when fields are automatically generated by reflection. Use only the part of the name after get/set, i.e., "Name" for the field corresponding to getName/setName methods.

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.