com.vaadin.data.fieldgroup
Class DefaultFieldGroupFieldFactory

java.lang.Object
  extended by com.vaadin.data.fieldgroup.DefaultFieldGroupFieldFactory
All Implemented Interfaces:
FieldGroupFieldFactory, java.io.Serializable
Direct Known Subclasses:
Grid.EditorFieldFactory

public class DefaultFieldGroupFieldFactory
extends java.lang.Object
implements FieldGroupFieldFactory

This class contains a basic implementation for FieldGroupFieldFactory .The class is singleton, use get() method to get reference to the instance.

Author:
Vaadin Ltd
See Also:
Serialized Form

Field Summary
static java.lang.Object CAPTION_PROPERTY_ID
           
 
Constructor Summary
protected DefaultFieldGroupFieldFactory()
           
 
Method Summary
protected  boolean anyField(java.lang.Class<?> fieldType)
           
protected  boolean anySelect(java.lang.Class<? extends Field> fieldType)
           
protected
<T extends AbstractTextField>
T
createAbstractTextField(java.lang.Class<T> fieldType)
           
protected
<T extends Field>
T
createBooleanField(java.lang.Class<T> fieldType)
           
protected  AbstractSelect createCompatibleSelect(java.lang.Class<? extends AbstractSelect> fieldType)
           
protected
<T extends Field>
T
createDefaultField(java.lang.Class<?> type, java.lang.Class<T> fieldType)
          Fallback when no specific field has been created.
<T extends Field>
T
createField(java.lang.Class<?> type, java.lang.Class<T> fieldType)
          Creates a field based on the data type that we want to edit
protected  RichTextArea createRichTextArea()
           
static DefaultFieldGroupFieldFactory get()
          Gets the singleton instance.
protected  void populateWithEnumData(AbstractSelect select, java.lang.Class<? extends java.lang.Enum> enumClass)
          Populates the given select with all the enums in the given Enum class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CAPTION_PROPERTY_ID

public static final java.lang.Object CAPTION_PROPERTY_ID
Constructor Detail

DefaultFieldGroupFieldFactory

protected DefaultFieldGroupFieldFactory()
Method Detail

get

public static DefaultFieldGroupFieldFactory get()
Gets the singleton instance.

Returns:
the singleton instance
Since:
7.4

createField

public <T extends Field> T createField(java.lang.Class<?> type,
                                       java.lang.Class<T> fieldType)
Description copied from interface: FieldGroupFieldFactory
Creates a field based on the data type that we want to edit

Specified by:
createField in interface FieldGroupFieldFactory
Parameters:
type - The type that we want to edit using the field
fieldType - The type of field we want to create. If set to Field then any type of field is accepted
Returns:
A field that can be assigned to the given fieldType and that is capable of editing the given type of data

createRichTextArea

protected RichTextArea createRichTextArea()

createCompatibleSelect

protected AbstractSelect createCompatibleSelect(java.lang.Class<? extends AbstractSelect> fieldType)

anyField

protected boolean anyField(java.lang.Class<?> fieldType)
Parameters:
fieldType - the type of the field
Returns:
true if any AbstractField can be assigned to the field
Since:
7.4

anySelect

protected boolean anySelect(java.lang.Class<? extends Field> fieldType)
Parameters:
fieldType - the type of the field
Returns:
true if any AbstractSelect can be assigned to the field
Since:
7.4

createBooleanField

protected <T extends Field> T createBooleanField(java.lang.Class<T> fieldType)

createAbstractTextField

protected <T extends AbstractTextField> T createAbstractTextField(java.lang.Class<T> fieldType)

createDefaultField

protected <T extends Field> T createDefaultField(java.lang.Class<?> type,
                                                 java.lang.Class<T> fieldType)
Fallback when no specific field has been created. Typically returns a TextField.

Type Parameters:
T - The type of field to create
Parameters:
type - The type of data that should be edited
fieldType - The type of field to create
Returns:
A field capable of editing the data or null if no field could be created

populateWithEnumData

protected void populateWithEnumData(AbstractSelect select,
                                    java.lang.Class<? extends java.lang.Enum> enumClass)
Populates the given select with all the enums in the given Enum class. Uses Enum.toString() for caption.

Parameters:
select - The select to populate
enumClass - The Enum class to use


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.