uic.output.builder
Class UICBuilder

java.lang.Object
  extended byuic.output.builder.UICBuilder

public class UICBuilder
extends Object

The builder that combines all widgets and can be passed to the instanciator or the fileWriter


Field Summary
protected  ContainerRepresenter root
           
protected  VariableManager varManager
           
 
Constructor Summary
UICBuilder(String packageName, String className)
           
 
Method Summary
 void addImplements(String implementsInterfaceName)
          Add an interface the resulting class should implement.
 void addStaticMethodCall(MethodRepresenter method)
          If you need a static method call during the construction of your container, add it here.
 ContainerRepresenter createContainer(String className)
          Convenience method for the next one.
 ContainerRepresenter createContainer(String name, String className)
          Convenience method for the next one.
 ContainerRepresenter createContainer(String name, String className, boolean export)
          Create a new container in the output.
 WidgetRepresenter createWidget(String className)
          Convenience method for the next one.
 WidgetRepresenter createWidget(String className, MethodRepresenter parent)
           
 WidgetRepresenter createWidget(String className, MethodRepresenter parent, String name, boolean export)
           
 WidgetRepresenter createWidget(String name, String className)
          Convenience method for the next one.
 WidgetRepresenter createWidget(String name, String className, boolean export)
          Create a new Widget in the output.
 String getClassName()
          get the class name of the resulting class, a writer should name the file after this.
 String getExtends()
          get the fullclasspath of the class that the new class should extend.
 Iterator getImplementsIter()
          Get an iterator over a list of strings with the interfaces the new class should implement.
 String getPackageName()
          get the package name of the resulting class.
 ContainerRepresenter getRootContainer()
          Fetch the root container
 List getStaticMethodCalls()
           
 WidgetRepresenter getWidget(String name)
          Fetch a name widget that has been created earlier with the createWidget method.
 List getWidgets()
          Get the list of all widgets registered.
 boolean isAbstractClass()
           
 void setAsRoot(ContainerRepresenter container)
          Make a container be the root container which means it will be 'attached' to the newly made class.
 void setClassName(String className)
          get the class name of the resulting class, a writer should name the file after this.
 void setClassToAbstract(boolean on)
           
 void setExtends(String extendsClassName)
          Set the fullclasspath of the class that the new class should extend.
 void setPackageName(String packageName)
          Set the package name of the resulting class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

varManager

protected VariableManager varManager

root

protected ContainerRepresenter root
Constructor Detail

UICBuilder

public UICBuilder(String packageName,
                  String className)
Method Detail

createWidget

public WidgetRepresenter createWidget(String className)
Convenience method for the next one. Creates a nameless widget with export = false


createWidget

public WidgetRepresenter createWidget(String name,
                                      String className)
Convenience method for the next one. sets export to true


createWidget

public WidgetRepresenter createWidget(String name,
                                      String className,
                                      boolean export)
Create a new Widget in the output.

Parameters:
name - the name for the widget; this is the name that is used as the class-member name.
className - this can be two things; either the full class name (javax.swing.JPanel) or the short-name you registered with addWidgetMapping
export - mark the widget to be a package variable instead of being inlined.

createWidget

public WidgetRepresenter createWidget(String className,
                                      MethodRepresenter parent,
                                      String name,
                                      boolean export)

createWidget

public WidgetRepresenter createWidget(String className,
                                      MethodRepresenter parent)

getWidget

public WidgetRepresenter getWidget(String name)
Fetch a name widget that has been created earlier with the createWidget method.

Returns:
the named widget, or null when not found.

createContainer

public ContainerRepresenter createContainer(String className)
Convenience method for the next one. Creates a "panel"


createContainer

public ContainerRepresenter createContainer(String name,
                                            String className)
Convenience method for the next one. does not export


createContainer

public ContainerRepresenter createContainer(String name,
                                            String className,
                                            boolean export)
Create a new container in the output. A container is a widget that contains other widgets.

Parameters:
name - the name for the widget; this is the name that is used as the class-member name.
className - this can be two things; either the full class name (javax.swing.JPanel)
export - mark the widget to be a package variable instead of being inlined.

setAsRoot

public void setAsRoot(ContainerRepresenter container)
Make a container be the root container which means it will be 'attached' to the newly made class.

Parameters:
container - which has previosly been registered using the createContainer method.

getRootContainer

public ContainerRepresenter getRootContainer()
Fetch the root container


getWidgets

public List getWidgets()
Get the list of all widgets registered. Note that the ordering can be different from the order in adding the widgets since dependency checking is done.

Returns:
a Vector with WidgetRepresenter objects.

setPackageName

public void setPackageName(String packageName)
Set the package name of the resulting class.


getPackageName

public String getPackageName()
get the package name of the resulting class.


getClassName

public String getClassName()
get the class name of the resulting class, a writer should name the file after this.


setClassName

public void setClassName(String className)
get the class name of the resulting class, a writer should name the file after this.


setExtends

public void setExtends(String extendsClassName)
Set the fullclasspath of the class that the new class should extend.


getExtends

public String getExtends()
get the fullclasspath of the class that the new class should extend.


addImplements

public void addImplements(String implementsInterfaceName)
Add an interface the resulting class should implement. Don't forget to add the relevant methods as well.


setClassToAbstract

public void setClassToAbstract(boolean on)

isAbstractClass

public boolean isAbstractClass()

getImplementsIter

public Iterator getImplementsIter()
Get an iterator over a list of strings with the interfaces the new class should implement.


addStaticMethodCall

public void addStaticMethodCall(MethodRepresenter method)
If you need a static method call during the construction of your container, add it here. A System.out.println("Done!") is a (silly) example you can add, notice that the placing of this call is not defined; but likely to be at the end.


getStaticMethodCalls

public List getStaticMethodCalls()


Copyright © 2002,2003 Thomas Zander Available under the Free Apache licence