com.abstractics.xmlpanel.swing.componentcreator
Interface ComponentCreator

All Known Implementing Classes:
AbstractComponentCreator, XmlPanel.XmlPanelComponentCreator

public interface ComponentCreator

ComponentCreator is an interface that can be implemented to create components via the ComponentFactory. Classes that implement this interface should be instantiated and added to the ComponentFactory so that they are used in the creation of panels.

Version:
$Id: ComponentCreator.java,v 1.3 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:
ComponentFactory

Method Summary
 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.
 java.lang.String[] getComponentTypes()
           
 

Method Detail

createComponent

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

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!

getComponentTypes

public java.lang.String[] getComponentTypes()
Returns:
Return the type name(s) that this XmlPanelComponentCreator is known by. When cell tags are found with a type attribute that matches one of these values (case-insensitive), then this component creator will be used