lib.java
Class Layout

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

@WidgetDef.Abstract
@WidgetDef.Contained
public class Layout
extends WidgetDef

Abstract widget type for any Layout.

This type actually does nothing; it's much like a tagging interface in Java - that is, one that has no members, and which is only used in testing membership in a class. See the code for the Window widget type.


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
Layout(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>> 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, getChildDefaults, 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

Layout

public Layout(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)
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.

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

addChild

public String addChild(String childType,
                       String childId,
                       GUIAttributes attrs)
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.

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.