jgb.handlers.swing
Class AbstractControlTagHandler

java.lang.Object
  |
  +--jgb.handlers.swing.AbstractTagHandler
        |
        +--jgb.handlers.swing.AbstractControlTagHandler
All Implemented Interfaces:
TagHandler
Direct Known Subclasses:
BorderTagHandler, ButtonTagHandler, CheckTagHandler, ComboTagHandler, ControlTagHandler, GlueTagHandler, ItemTagHandler, LabelTagHandler, LayoutTagHandler, MenuBarTagHandler, MenuTagHandler, PanelTagHandler, RadioTagHandler, SeparatorTagHandler, SheetTagHandler, StrutTagHandler, TextfieldTagHandler

public abstract class AbstractControlTagHandler
extends AbstractTagHandler

Since:
0.2.1a
Author:
Francois Beausoleil, fbos@users.sourceforge.net

Field Summary
protected static String ATTR_ACCELERATOR
          The name of the accelerator attribute.
protected static String ATTR_GROUP
          The name of the group attribute.
protected static String ATTR_MNEMONIC
          The name of the mnemonic attribute.
protected static String ATTR_REFLABEL
          The name of the reflabel attribute.
protected static String ATTR_SELECTED
          The name of the selected attribute.
protected static String ATTR_TEXT
          The name of the text attribute.
protected static String ATTR_TYPE
          The name of the type attribute.
static String TYPE_RADIO
          The value of the type attribute which instantiates a radio menu item.
 
Fields inherited from class jgb.handlers.swing.AbstractTagHandler
ATTR_CLASS, ATTR_ID, ATTR_REFID, tagContext, tagName
 
Fields inherited from interface jgb.builder.TagHandler
CALL_RETURN_CLASS_KEY, CALL_RETURN_VALUE_KEY, CONSTANTS_MAP_KEY, CONTROLS_STACK_KEY, CURRENT_CONSTRAINTS_KEY, CURRENT_MODEL_ADAPTER, CURRENT_MODEL_ATTRIBUTE, CURRENT_OBJECT_ID_KEY, CURRENT_OBJECT_KEY, CURRENT_OBJECTS_STACK_KEY, CURRENT_PARM_ACC_KEY, CURRENT_WINDOW_ID_KEY, CURRENT_WINDOW_KEY, DOCUMENT_LOCATOR_KEY, MODEL_ID, OBJECTS_MAP_KEY, PARAMETER_CLASS_KEY, PARAMETER_VALUE_KEY, PROPERTY_NAME_KEY, TAG_HANDLER_FACTORY_STACK_KEY, WINDOW_CONTEXT_KEY, WINDOW_KEY
 
Constructor Summary
AbstractControlTagHandler()
           
 
Method Summary
protected  String calcControlClassName(String baseClassName)
          Convenience method that prefixes the passed base class name with the subclass' implementation of getDefaultPackagePrefix().
protected  Object getCurrentConstraints()
          Convenience method that returns the context's current value in the TagHandler.CURRENT_CONSTRAINTS_KEY key.
protected  Component getCurrentControl()
          Convenience method that automatically casts the current object to a Component.
protected  String getCurrentControlId()
          Convenience method that maps directly to getCurrentObjectId().
protected abstract  String getDefaultPackagePrefix()
          Returns the default package in which to search for class names.
protected  boolean isCurrentControlValid()
          Convenience method that maps directly to isCurrentObjectValid().
protected  void popCurrentControl()
          Convenience method that maps to popCurrentObject().
protected  void pushCurrentControl(Component component)
          Convenience method that maps to pushCurrentObject(String, Object).
protected  void pushCurrentControl(Component component, String id)
          Convenience method that maps to pushCurrentObject(String, Object).
 
Methods inherited from class jgb.handlers.swing.AbstractTagHandler
endElement, enterElement, exitElement, getCurrentObject, getCurrentObjectId, getObject, isCurrentObjectValid, popCurrentObject, pushCurrentObject, pushCurrentObject, putComponent, putObject, startElement, throwParsingException, throwParsingException, throwParsingException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_RADIO

public static final String TYPE_RADIO
The value of the type attribute which instantiates a radio menu item.

See Also:
Constant Field Values

ATTR_TYPE

protected static final String ATTR_TYPE
The name of the type attribute.

See Also:
Constant Field Values

ATTR_TEXT

protected static final String ATTR_TEXT
The name of the text attribute.

See Also:
Constant Field Values

ATTR_MNEMONIC

protected static final String ATTR_MNEMONIC
The name of the mnemonic attribute.

See Also:
Constant Field Values

ATTR_ACCELERATOR

protected static final String ATTR_ACCELERATOR
The name of the accelerator attribute.

See Also:
Constant Field Values

ATTR_GROUP

protected static final String ATTR_GROUP
The name of the group attribute.

See Also:
Constant Field Values

ATTR_REFLABEL

protected static final String ATTR_REFLABEL
The name of the reflabel attribute.

See Also:
Constant Field Values

ATTR_SELECTED

protected static final String ATTR_SELECTED
The name of the selected attribute.

See Also:
Constant Field Values
Constructor Detail

AbstractControlTagHandler

public AbstractControlTagHandler()
Method Detail

pushCurrentControl

protected void pushCurrentControl(Component component)
Convenience method that maps to pushCurrentObject(String, Object). This method acceps a Component instead of a generic Object.


pushCurrentControl

protected void pushCurrentControl(Component component,
                                  String id)
Convenience method that maps to pushCurrentObject(String, Object). This method acceps a Component instead of a generic Object.


popCurrentControl

protected void popCurrentControl()
Convenience method that maps to popCurrentObject().


getCurrentControl

protected Component getCurrentControl()
Convenience method that automatically casts the current object to a Component.


getCurrentControlId

protected String getCurrentControlId()
Convenience method that maps directly to getCurrentObjectId().


isCurrentControlValid

protected boolean isCurrentControlValid()
Convenience method that maps directly to isCurrentObjectValid().


getCurrentConstraints

protected Object getCurrentConstraints()
Convenience method that returns the context's current value in the TagHandler.CURRENT_CONSTRAINTS_KEY key.


calcControlClassName

protected String calcControlClassName(String baseClassName)
Convenience method that prefixes the passed base class name with the subclass' implementation of getDefaultPackagePrefix(). This method will not prefix the base class name with anything if it contains a period ('.').
For instance, if baseClassName equals "java.awt.Button", it will return "java.awt.Button".
But, if baseClassName equals "JButton" and getDefaultPackagePrefix() returns "javax.swing.", then this method will return "javax.swing.JButton".
Please note that this method will not be able to return a class name from the default package, unless the specific subclass returns "" from getDefaultPackagePrefix().

Parameters:
baseClassName - A class name, with or without a package.
Returns:
A fully qualified class name, with the default package prefixed to the base class name if none was specified.

getDefaultPackagePrefix

protected abstract String getDefaultPackagePrefix()
Returns the default package in which to search for class names. This method supplies the missing information in calcControlClassName(String).



Copyright 2002-2003, François Beausoleil, All Rights Reserved