lib.java
Class Window

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

@WidgetDef.Derived(value=Container.class)
public class Window
extends WidgetDef


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
Window(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 childAttrs)
          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.
 ArrayList<String> getModifiers()
          getModifiers returns a list of methods designed to modify various attributes of the widget type in question.
 Map<String,String> getSynonymousAttributes()
          Specifies synonymous attributes.
 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 postamble()
          Get the chunk of initialization code to be run after everything else is done.
 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, hashCode, isAbstract, isAbstract, isContained, isContained, isContained, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, isDerivedFrom, processAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Window

public Window(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.

postamble

public String postamble()
Description copied from class: WidgetDef
Get the chunk of initialization code to be run after everything else is done. This is an empty string by default.

Note that the WidgetDef.preamble() and postamble are not inherited (much as Java constructors aren't).

Overrides:
postamble in class WidgetDef
Returns:
Final-phase initialization 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

getSynonymousAttributes

public Map<String,String> getSynonymousAttributes()
Description copied from class: WidgetDef
Specifies synonymous attributes. For each entry in this map, the key is the name of an attribute (which does not appear in WidgetDef.getDefaults()), and the value is the name of the real attribute with which that attribute is synonymous (i.e. equivalent).

By default, returns the empty map; WidgetDef subclasses may override to specify synonymous attributes.

Overrides:
getSynonymousAttributes in class WidgetDef
Returns:
The map of synonymous attributes.

addChild

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

getModifiers

public ArrayList<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.

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.

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.