types
Class Widget

java.lang.Object
  extended by types.Widget

public abstract class Widget
extends Object

The general type of all widgets.


Field Summary
 Map<String,Integer> attrLineNums
          A mapping from attribute names to the line numbers at which they were specified.
 Map<String,List<String>> attrs
          A mapping from attribute names to values.
 List<Widget> children
          A list of the widget's children.
 GUIFile file
          The .gui file declaring this widget.
 String id
          The identifier of the widget.
protected static int lastAnonIdNumber
          The number appended to the last anonymous identifier generated.
 int lineNum
          The line number at which this widget was declared.
 Widget parent
          The widget's parent, or null for a top-level widget.
 String type
          The identifier of the type of the widget.
 
Constructor Summary
protected Widget(String type, String id, GUIFile file, int lineNum)
           
protected Widget(String type, String id, Widget parent, GUIFile file, int lineNum)
           
 
Method Summary
protected static String formatValueList(List<String> values)
          Format a list of values for printing.
protected static String mkAnonId()
           
protected static String mkAnonId(String type)
          Make an anonymous identifier for a widget of the given type.
protected static String mkIdIfNeeded(String id)
          Make an anonymous identifier if needed.
protected static String mkIdIfNeeded(String id, String type)
          Make an anonymous identifier, if needed, for a widget of the given type.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

public final String id
The identifier of the widget.


type

public final String type
The identifier of the type of the widget.


parent

public final Widget parent
The widget's parent, or null for a top-level widget.


children

public final List<Widget> children
A list of the widget's children. Is probably not modifiable.


attrs

public final Map<String,List<String>> attrs
A mapping from attribute names to values. Is probably not modifiable.


file

public final GUIFile file
The .gui file declaring this widget.


lineNum

public final int lineNum
The line number at which this widget was declared.


attrLineNums

public final Map<String,Integer> attrLineNums
A mapping from attribute names to the line numbers at which they were specified.


lastAnonIdNumber

protected static int lastAnonIdNumber
The number appended to the last anonymous identifier generated.

Constructor Detail

Widget

protected Widget(String type,
                 String id,
                 GUIFile file,
                 int lineNum)
Parameters:
type - The identifier of the type of the widget.
id - The identifier of the widget, or null for anonymous.
file - The GUIFile in which the widget was declared.
lineNum - The line number at which this widget was declared.

Widget

protected Widget(String type,
                 String id,
                 Widget parent,
                 GUIFile file,
                 int lineNum)
Parameters:
type - The identifier of the type of the widget.
id - The identifier of the widget, or null for anonymous.
parent - The widget's parent widget, or null for a top-level widget.
file - The GUIFile in which the widget was declared.
lineNum - The line number at which this widget was declared.
Method Detail

mkAnonId

protected static String mkAnonId()
Returns:
A unique, newly generated anonymous identifier.

mkIdIfNeeded

protected static String mkIdIfNeeded(String id)
Make an anonymous identifier if needed.

Parameters:
id - An identifier.
Returns:
id if id != null && id.length() > 0; a new anonymous identifier otherwise.
See Also:
mkAnonId()

mkAnonId

protected static String mkAnonId(String type)
Make an anonymous identifier for a widget of the given type.

Parameters:
type - The type of the widget.
Returns:
A unique, newly generated anonymous identifier.

mkIdIfNeeded

protected static String mkIdIfNeeded(String id,
                                     String type)
Make an anonymous identifier, if needed, for a widget of the given type.

Parameters:
id - An identifier.
type - The type of the widget.
Returns:
id if id != null && id.length() > 0; a new anonymous identifier otherwise.
See Also:
mkAnonId()

formatValueList

protected static String formatValueList(List<String> values)
Format a list of values for printing.

Parameters:
values - A list of values.
Returns:
The values, surrounded by typographer's (Unicode) quotes and delimited by commas.

toString

public String toString()
Overrides:
toString in class Object