lib.java
Class GridLayout

java.lang.Object
  extended by types.WidgetDef
      extended by lib.java.GridLayout

@WidgetDef.Derived(value=Layout.class)
public class GridLayout
extends WidgetDef

Widget Definition for a grid layout in Java.


Nested Class Summary
 
Nested classes/interfaces inherited from class types.WidgetDef
WidgetDef.Abstract, WidgetDef.Contained, WidgetDef.Derived
 
Field Summary
 
Fields inherited from class types.WidgetDef
id, parent, widget
 
Constructor Summary
GridLayout(Widget widget, WidgetDef parent)
           
 
Method Summary
 String addAttributes(GUIAttributes attrs)
          The addAttributes code does two things; it creates the lib.java code necessary for the attributes and it type checks for all attributes.
 String addChild(String childType, String childId, GUIAttributes attrs)
          Check to make sure the childType is legal for the widget, then add it.
 Map<String,List<String>> getChildDefaults()
          Specifies the child attributes for the widget.
 Map<String,List<String>> getDefaults()
          Every attribute in our language has to have a default setting.
 Set<String> getImports()
          getImports keeps a Set of import lines that are pertinent to the code generated in the other methods.
 String getLanguage()
          Accessor method for the Widget language.
 List<String> getModifiers()
          getModifiers returns a list of methods designed to modify various attributes of the widget type in question.
 List<String> getVariables()
          Returns a chunk of code intended to declare variables which the backend code may need access to and therefore should be declared outside of the constructor code.
 String preamble()
          Get the chunk of initialization code to be run first.
 
Methods inherited from class types.WidgetDef
commentForm, defineWidget, defineWidget, equals, getAncestry, getBaseWidgetDefClasses, getBaseWidgetDefClasses, getBaseWidgetDefClasses, getBaseWidgetDefs, getChildModifiers, getCommentName, getInnerClasses, getMultisynonymousAttributes, getSynonymousAttributes, hashCode, isAbstract, isAbstract, isContained, isContained, isContained, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, postamble, processAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridLayout

public GridLayout(Widget widget,
                  WidgetDef parent)
Method Detail

getLanguage

public String getLanguage()
Description copied from class: WidgetDef
Accessor method for the Widget language.

Specified by:
getLanguage in class WidgetDef
Returns:
language

preamble

public String preamble()
Description copied from class: WidgetDef
Get the chunk of initialization code to be run first. Typically this code will declare a local variable for the widget.

Note that, by its nature, a preamble should only be called once; therefore the preamble is not inherited.

Specified by:
preamble in class WidgetDef
Returns:
Instatiation code.

addAttributes

public String addAttributes(GUIAttributes attrs)
                     throws BadAttributeException
Description copied from class: WidgetDef
The addAttributes code does two things; it creates the lib.java code necessary for the attributes and it type checks for all attributes. A BadAttributeException is thrown if the names or the values are erroneous. If an attribute is not found in the GUIAttributes, a BadAttributeNameException is thrown from GUIAttributes.

Specified by:
addAttributes in class WidgetDef
Parameters:
attrs - The attributes to set for the widget.
Returns:
The generated code to set the attributes.
Throws:
BadAttributeException

getDefaults

public Map<String,List<String>> getDefaults()
Description copied from class: WidgetDef
Every attribute in our language has to have a default setting. This returns all the defaults in a map of Strings to Lists of Strings.

Specified by:
getDefaults in class WidgetDef
Returns:
Map of attribute defaults

getChildDefaults

public Map<String,List<String>> getChildDefaults()
Description copied from class: WidgetDef
Specifies the child attributes for the widget. A container widget can have associated attributes that are attributes not of the container itself but of its children. For instance, any widget in a GridLayout has attributes for its position and span; it has these attributes not because of its widget type, but because of its parent's widget type. Such are called child attributes.

Overrides:
getChildDefaults in class WidgetDef
Returns:
A map of the default values for the child attributes
See Also:
WidgetDef.getDefaults()

addChild

public String addChild(String childType,
                       String childId,
                       GUIAttributes attrs)
                throws BadChildWidgetException,
                       BadAttributeException
Description copied from class: WidgetDef
Check to make sure the childType is legal for the widget, then add it.

Overrides:
addChild in class WidgetDef
Parameters:
childType - The widget type of the child.
childId - The identifier of the child.
attrs - The child's GUIAttributes map. Child attributes will be read from this map.
Returns:
The generated code to add the child to this widget.
Throws:
BadChildWidgetException - If the child is of an inappropriate type. For instance, a menu can only have certain widgets (items, submenus, etc.) as children.
BadAttributeException - If one of the given attributes is erroneous.

getImports

public Set<String> getImports()
Description copied from class: WidgetDef
getImports keeps a Set of import lines that are pertinent to the code generated in the other methods.

Specified by:
getImports in class WidgetDef
Returns:
Set of import strings.

getModifiers

public List<String> getModifiers()
Description copied from class: WidgetDef
getModifiers returns a list of methods designed to modify various attributes of the widget type in question. When getModifiers is called, the accessors and mutators for all attributes are returned.

Specified by:
getModifiers in class WidgetDef
Returns:
List of mutators and accessors for the widget type.

getVariables

public List<String> getVariables()
Description copied from class: WidgetDef
Returns a chunk of code intended to declare variables which the backend code may need access to and therefore should be declared outside of the constructor code.

Specified by:
getVariables in class WidgetDef
Returns:
Variable Declaration for the widget.