org.jdesktop.swing.form
Class DefaultFormFactory

java.lang.Object
  extended byorg.jdesktop.swing.form.FormFactory
      extended byorg.jdesktop.swing.form.DefaultFormFactory

public class DefaultFormFactory
extends FormFactory

note:technically this should probably be in a FormUI, or initialized from a FormUI.


Constructor Summary
DefaultFormFactory()
           
 
Method Summary
 void addComponent(JComponent parent, JComponent component, MetaData metaData)
          Adds the component to the specified parent container and configures its layout within that container according to the form factory's layout paradigm.
 Binding createBinding(DataModel model, String fieldName, JComponent component)
          Factory method for returning the binding object which connects the user-interface component to the specified field in a data model.
 JComponent createComponent(MetaData metaData)
          Factory method for returning the user-interface component best suited to edit/display values for the data model field represented by the metaData object.
 
Methods inherited from class org.jdesktop.swing.form.FormFactory
getDefaultFormFactory, setDefaultFormFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFormFactory

public DefaultFormFactory()
Method Detail

createComponent

public JComponent createComponent(MetaData metaData)
Description copied from class: FormFactory
Factory method for returning the user-interface component best suited to edit/display values for the data model field represented by the metaData object. The returned component is not only based on the metadata's type, but also on it's edit constraints.

Specified by:
createComponent in class FormFactory
Parameters:
metaData - object which describes the named field
Returns:
JComponent which can display/edit values defined by the metaData object

createBinding

public Binding createBinding(DataModel model,
                             String fieldName,
                             JComponent component)
Description copied from class: FormFactory
Factory method for returning the binding object which connects the user-interface component to the specified field in a data model.

Specified by:
createBinding in class FormFactory
Parameters:
model - data model object to which the component is being bound
fieldName - String containing the name of the field within the data model
component - JComponent which can display/edit values defined by the metaData object
Returns:
Binding instance which binds the component to the field in the data model

addComponent

public void addComponent(JComponent parent,
                         JComponent component,
                         MetaData metaData)
Description copied from class: FormFactory
Adds the component to the specified parent container and configures its layout within that container according to the form factory's layout paradigm. If the metaData argument is not null, then a label will be automatically created and aligned with the component. Note that the component being added need not be the component which has the binding. For example, an edit component may be contained within another container (scrollpane, panel, etc); the edit component will have the binding, but the container is what must be added to the form.

Specified by:
addComponent in class FormFactory
Parameters:
parent - Container where the component is being added
component - JComponent being added to the container
metaData - object which describes the named field


Copyright 2004 by Sun Microsystems, Inc. All Rights Reserved.