Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.jdeveloper.builder.cls
Interface Generator

All Known Implementing Classes:
AbstractGenerator, ClassGenerator

public interface Generator

The interface implemented by all Class Generators. A Generator is responsible for generating custom code for specific class types. The Generator is expected to provide to a JComponent offering Attributes supported by a given class type. These Attributes will be exposed by the Builder for user manipulation. The Builder will generate the basic code for the new class; the Generator will then be asked to add whatever additional code is required for the selected class type.

A Generator can support multiple base classes. The specific base classes are registered in the ide.properties files in the following format:

jdeveloper.<ui type>.generator.<base class>=<fully qualified generator class name>

For example, the generator for java.awt.Frame classes used by the Frame Builder is entered as jdeveloper.frame.generator.java.awt.frame=oracle.jdeveloper.wizard.frame.FrameGenerator


Method Summary
 void generate(JavaManager mgr, SourceFile srcFile)
          Tells the Generator to add whatever custom code it requires.
 javax.swing.JComponent getAttributes(java.lang.String baseType)
          Provides the Attributes panel supported by this Generator.
 java.lang.String getClassDescription(java.lang.String baseType)
          Provides a description of the class being generated by this UIGenerator.
 java.lang.String[] getLibraries(java.lang.String baseType)
          Provides a list of JDeveloper libraries required by the code generated by this Generator for the specified base type.
 void setContext(Context ctx)
          Sets the context in which the generator is being accessed.
 void setEnabled(boolean isEnabled)
          Sets the enabled state of all UI present on the object returned by getAttributes.
 boolean validateAttributes()
          Allows the supplied Attributes panel to be validated.
 

Method Detail

getAttributes

javax.swing.JComponent getAttributes(java.lang.String baseType)
Provides the Attributes panel supported by this Generator. This panel will be used by the Builder to populate the option area for selection by the user.

Parameters:
baseType - The base class for which the attributes are requested.
Returns:
The JContainer object representing the available attributes for the base class.

validateAttributes

boolean validateAttributes()
Allows the supplied Attributes panel to be validated. This method is called from ClassBuilderPanel.validateAndWriteToState(oracle.jdeveloper.wizard.common.BaliWizardState)

Returns:
trueif the settings in the Attributes panel are valid, and false otherwise.

setEnabled

void setEnabled(boolean isEnabled)
Sets the enabled state of all UI present on the object returned by getAttributes.

Parameters:
isEnabled - The enabled state to set all UI controls to.

generate

void generate(JavaManager mgr,
              SourceFile srcFile)
Tells the Generator to add whatever custom code it requires.

Parameters:
mgr - The JavaManager object representing the current project.
srcFile - The SourceFile object representing the new file.

getLibraries

java.lang.String[] getLibraries(java.lang.String baseType)
Provides a list of JDeveloper libraries required by the code generated by this Generator for the specified base type. These libraries will be added to the project when the Builder initializes, allowing the user to use the browse functionality within the libraries. If the base class is not the class requested by the user when the Builder completes, or the user elects to cancel the Builder, the libraries will be removed from the JProject.

Parameters:
baseType - The base class for which the list of libraries are requested.
Returns:
An array of Strings indicating the libraries required by the base type.

getClassDescription

java.lang.String getClassDescription(java.lang.String baseType)
Provides a description of the class being generated by this UIGenerator.

Parameters:
baseType - The base class of the class.
Returns:
the description of the class.

setContext

void setContext(Context ctx)
Sets the context in which the generator is being accessed.

Parameters:
context - the current context.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.