com.abstractics.xmlpanel.swing.componentcreator
Class AbstractComponentCreator

java.lang.Object
  extended bycom.abstractics.xmlpanel.swing.componentcreator.AbstractComponentCreator
All Implemented Interfaces:
ComponentCreator
Direct Known Subclasses:
GenericClassComponentCreator, JScrollPaneCreator

public abstract class AbstractComponentCreator
extends java.lang.Object
implements ComponentCreator

This abstract version of XmlPanelComponentCreator can be used as a basis for creator objects. This class handles the setting of properties on the created Component via reflection.

Version:
$Id: AbstractComponentCreator.java,v 1.2 2006/03/15 05:37:40 andyman99 Exp $
Author:
Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache License, Version 2.0
See Also:
ComponentCreatorUtils.applyPropertiesViaReflection(Component, Element), com.abstractics.xmlpanel.swing.componentcreator.ComponentCreatorUtils#applyBorder(Component, Element)

Constructor Summary
AbstractComponentCreator()
           
 
Method Summary
abstract  java.awt.Component constructComponent(org.w3c.dom.Element element, XmlPanel panel)
          Given an element representing a cell in an XMLPanel, this method should construct the appropriate Component for the type that this component is looking for, setting all of the properties necessary.

This method will be called by this abstract class to create the component before setting the properties and border.
 java.awt.Component createComponent(org.w3c.dom.Element element, XmlPanel panel)
          Given an element representing a cell in an XMLPanel, this method should construct the appropriate Component for the type that this component is looking for, setting all of the properties necessary.
The XmlPanel is given in case it is needed to determine properties of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.abstractics.xmlpanel.swing.componentcreator.ComponentCreator
getComponentTypes
 

Constructor Detail

AbstractComponentCreator

public AbstractComponentCreator()
Method Detail

constructComponent

public abstract java.awt.Component constructComponent(org.w3c.dom.Element element,
                                                      XmlPanel panel)
Given an element representing a cell in an XMLPanel, this method should construct the appropriate Component for the type that this component is looking for, setting all of the properties necessary.

This method will be called by this abstract class to create the component before setting the properties and border.

Parameters:
element - XML element to parse through
panel - The XmlPanel that this component is being placed into - for reference only!. This method should not mutate the panel in any way. It is also possible that this parameter could be null, so always check first.
Returns:
The resulting java.awt.Component
Throws:
java.lang.IllegalArgumentException - Throw this exception if there is a problem in instantiating the component - along with a good description of what the problem was!
See Also:
ComponentCreator.createComponent(Element, XmlPanel)

createComponent

public final java.awt.Component createComponent(org.w3c.dom.Element element,
                                                XmlPanel panel)
Description copied from interface: ComponentCreator
Given an element representing a cell in an XMLPanel, this method should construct the appropriate Component for the type that this component is looking for, setting all of the properties necessary.
The XmlPanel is given in case it is needed to determine properties of the component. Implementors should also consider using the XmlPanel to see if there is already a component with the same type and name in the panel, and use that component, instead of creating a new one. This will help with components retaining the properties they have set in code when runtime editing occurs.

Specified by:
createComponent in interface ComponentCreator
Parameters:
element - XML element to parse through
panel - The XmlPanel that this component is being placed into - for reference only!. This method should not mutate the panel in any way. It is also possible that this parameter could be null, so always check first.
Returns:
The resulting java.awt.Component