Enhydra 5.1 API

org.enhydra.tool.codegen
Class CodeGen

java.lang.Object
  |
  +--org.enhydra.tool.codegen.CodeGen
All Implemented Interfaces:
Constants

public class CodeGen
extends java.lang.Object
implements Constants

Main class for CodeGen wizard and command line interface.


Field Summary
static boolean debug
           
static boolean verbose
          When the verbose flag is true, file names stream out during file operations.
 
Fields inherited from interface org.enhydra.tool.codegen.Constants
CLIENT_SUFFIX, CONTENT_HTML, CONTENT_WML, DIR_AT_PACKAGE_DIR_AT, DIR_INPUT, DIR_LIB, DIR_MEDIA, DIR_OUTPUT, DIR_PRESENTATION, DIR_RESOURCES, DIR_SRC, DIR_TEMPLATE, DIR_TOOL, FILE_BUILD_XML, FILE_ENHYDRA_JAR, FILE_MAKEFILE, FILE_README_HTML, FILE_RUN_BAT_IN, FILE_RUN_IN, SYS_JAVA_VENDOR, SYS_JAVA_VERSION, SYS_USER_HOME, TAB4, TYPE_BAT, TYPE_CONF, TYPE_HTML, TYPE_IN, TYPE_JAVA, TYPE_MK, TYPE_TEMPLATE, TYPE_WML, TYPE_XML, XMLC_DEFAULT, XMLC_SUFFIX
 
Constructor Summary
CodeGen()
          Create an Code Generator in command line mode so that no swing components are instantiated.
CodeGen(boolean useSwing)
          Create an Code Generator and read in the codegen.properties file.
CodeGen(Generator sel)
          Create a Code Generator using a specified implementation of the Generator class.
 
Method Summary
 Generator[] getGenerators()
           
 int getOption()
          Get an integer representing the button selected by the use to close the wizard dialog.
 Generator getSelection()
          Get generator implementation to use for all generation operations.
 void initGenerators()
          Method declaration
protected  void invokeGenerator(java.lang.String[] args)
          Method declaration
 java.io.File[] invokeWizard(java.awt.Component host)
          Open the wizard dialog where a user can select what generator to use, specify generation options and generate the project.
 boolean isSwing()
           
protected  void list()
          Method declaration
 void setGenerators(Generator[] g)
           
 void setSelection(Generator sel)
           
 void setSwing(boolean b)
           
protected  void showGeneratorOptionHelp(java.lang.String commandName)
          Method declaration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug

verbose

public static boolean verbose
When the verbose flag is true, file names stream out during file operations.

Constructor Detail

CodeGen

public CodeGen()
        throws GeneratorException
Create an Code Generator in command line mode so that no swing components are instantiated.

Throws:
GeneratorException - Thrown if no generators could be instantiated. Warnings print out for each generators that could not be instantiated.

CodeGen

public CodeGen(boolean useSwing)
        throws GeneratorException
Create an Code Generator and read in the codegen.properties file. Use Beans instantiate to create instances of each generator listed in codegen.properties. Also pass the properties object into each generator.

Throws:
GeneratorException - Thrown if no generators could be instantiated. Warnings print out for each generators that could not be instantiated.

CodeGen

public CodeGen(Generator sel)
        throws GeneratorException
Create a Code Generator using a specified implementation of the Generator class. This constructor is used by Kelp to create seperate wizards for each generator.

Throws:
GeneratorException - Thrown if properties fail to initialize.
Method Detail

isSwing

public boolean isSwing()

setSwing

public void setSwing(boolean b)

getOption

public int getOption()
Get an integer representing the button selected by the use to close the wizard dialog.

Returns:
CodeGenDialog.CHOICE_FINISH or CodeGenDialog.CHOICE_CANCEL. The CHOICE_FINISH value indicates that code generation was attempted.

getSelection

public Generator getSelection()
Get generator implementation to use for all generation operations.

Returns:
A specific implementation of the generator interface.

setSelection

public void setSelection(Generator sel)

invokeWizard

public java.io.File[] invokeWizard(java.awt.Component host)
Open the wizard dialog where a user can select what generator to use, specify generation options and generate the project.

Parameters:
host - A component that can act as the owner of the modal dialog. May be null, Frame or Dialog.
Returns:
Returns an array of generated file references.

setGenerators

public void setGenerators(Generator[] g)

getGenerators

public Generator[] getGenerators()

initGenerators

public void initGenerators()
                    throws GeneratorException
Method declaration

GeneratorException

list

protected void list()
Method declaration


invokeGenerator

protected void invokeGenerator(java.lang.String[] args)
                        throws GeneratorException
Method declaration

Parameters:
args -
GeneratorException

showGeneratorOptionHelp

protected void showGeneratorOptionHelp(java.lang.String commandName)
Method declaration

Parameters:
commandName -

Enhydra 5.1 API