to.etc.domui.component.meta.impl
Class DefaultPropertyMetaModel<T>

java.lang.Object
  extended by to.etc.domui.component.meta.impl.BasicPropertyMetaModel<T>
      extended by to.etc.domui.component.meta.impl.DefaultPropertyMetaModel<T>
All Implemented Interfaces:
PropertyMetaModel<T>, IValueAccessor<T>, IValueTransformer<T>

public class DefaultPropertyMetaModel<T>
extends BasicPropertyMetaModel<T>
implements PropertyMetaModel<T>


Constructor Summary
DefaultPropertyMetaModel(DefaultClassMetaModel classModel, PropertyInfo descriptor)
           
 
Method Summary
 java.lang.Class<T> getActualType()
          Returns the actual type of the property's value.
<A> A
getAnnotation(java.lang.Class<A> annclass)
          This basic implementation returns annotations on the "getter" method of the property, if available.
 java.util.List<java.lang.Object> getAnnotations()
          This basic implementation returns all annotations on the "getter" method of the property, if available.
 ClassMetaModel getClassModel()
          The ClassModel that this property is a property of.
 java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
          If this should be represented by a combo this can be set to represent the default combo dataset.
 java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
          For a relation, this is the list of properties that should be shown.
 java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
          When this relation-property is presented as a single field this can contain a class to render that field as a string.
 java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
          When set this renderer should be used to render the nodes in the combobox.
 java.lang.String getComponentTypeHint()
          When present this gives a hint to the component factories to help with choosing a proper component to select a single record of the type specified by this property.
 java.lang.String getDefaultHint()
          Returns the default hint text (which pops up when the mouse is held over the control that inputs this item).
 java.lang.String getDefaultLabel()
          Return any default label (the text to use before the control that inputs this property) for this property.
 java.lang.String getDomainValueLabel(java.util.Locale loc, java.lang.Object val)
          Get a property-related translation for a domain value for this property.
 java.lang.Object[] getDomainValues()
          FIXME Needs to be filled in by some kind of factory, not in this thingy directly!! For enum and boolean property types this returns the possible values for the domain.
 java.lang.reflect.Type getGenericActualType()
          The abomination that is Java Generics requires a separate dysfunctional type system to represent generic typing, at the few places it is available.
 int getLength()
          Return the defined length for the item PROVIDED IT WAS SET - THIS SUFFERS FROM AN UTTER FUCKUP IN THE JPA "STANDARD".
 java.util.List<SearchPropertyMetaModel> getLookupFieldKeySearchProperties()
          When used in a LookupInput field, this fields are used to create the keyword search inputs.
 java.util.List<SearchPropertyMetaModel> getLookupFieldSearchProperties()
          When used in a LookupInput field, this fields are used to create the search inputs.
 java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.
 java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
          When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page.
 java.util.List<DisplayPropertyMetaModel> getLookupTableProperties()
          When used in a LookupInput field, this fields are used to show the result of a Search in the DataTable.
 java.lang.String getName()
          Returns the name of the property.
 PropertyRelationType getRelationType()
          Tells if this property represents some kind of database relation (a "parent" property referring to the master of this child record, or a property representing the list of children).
 java.lang.String getRenderHint()
           
 T getValue(java.lang.Object in)
          Retrieve the value from this object.
 ClassMetaModel getValueModel()
          If applicable, the value type's class model.
 boolean isPrimaryKey()
          Returns T if we know this property to be the PK.
 void setComboDataSet(java.lang.Class<? extends IComboDataSet<?>> comboDataSet)
           
 void setComboDisplayProperties(java.util.List<DisplayPropertyMetaModel> displayProperties)
           
 void setComboLabelRenderer(java.lang.Class<? extends ILabelStringRenderer<?>> comboLabelRenderer)
           
 void setComboNodeRenderer(java.lang.Class<? extends INodeContentRenderer<?>> comboNodeRenderer)
           
 void setComponentTypeHint(java.lang.String componentTypeHint)
           
 void setLength(int length)
           
 void setLookupFieldKeySearchProperties(java.util.List<SearchPropertyMetaModel> lookupFieldKeySearchProperties)
           
 void setLookupFieldSearchProperties(java.util.List<SearchPropertyMetaModel> lookupFieldSearchProperties)
           
 void setLookupSelectedProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldDisplayProperties)
           
 void setLookupSelectedRenderer(java.lang.Class<? extends INodeContentRenderer<?>> lookupFieldRenderer)
           
 void setLookupTableProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldTableProperties)
           
 void setPrimaryKey(boolean primaryKey)
           
 void setRelationType(PropertyRelationType relationType)
           
 void setRenderHint(java.lang.String renderHint)
           
 void setValue(java.lang.Object target, T value)
           
 java.lang.String toString()
           
 
Methods inherited from class to.etc.domui.component.meta.impl.BasicPropertyMetaModel
getControlFactory, getConverter, getDisplayLength, getEditRoles, getNumericPresentation, getPrecision, getReadOnly, getRegexpUserString, getRegexpValidator, getScale, getSortable, getTemporal, getValidators, getViewRoles, isRequired, isTransient, setControlFactory, setConverter, setDisplayLength, setEditRoles, setNumericPresentation, setPrecision, setReadOnly, setRegexpUserString, setRegexpValidator, setRequired, setScale, setSortable, setTemporal, setTransient, setValidators, setViewRoles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface to.etc.domui.component.meta.PropertyMetaModel
getControlFactory, getConverter, getDisplayLength, getEditRoles, getNumericPresentation, getPrecision, getReadOnly, getRegexpUserString, getRegexpValidator, getScale, getSortable, getTemporal, getValidators, getViewRoles, isRequired, isTransient
 

Constructor Detail

DefaultPropertyMetaModel

public DefaultPropertyMetaModel(DefaultClassMetaModel classModel,
                                PropertyInfo descriptor)
Method Detail

getName

public java.lang.String getName()
Description copied from interface: PropertyMetaModel
Returns the name of the property.

Specified by:
getName in interface PropertyMetaModel<T>
Returns:

getActualType

public java.lang.Class<T> getActualType()
Description copied from interface: PropertyMetaModel
Returns the actual type of the property's value. This is the return type of the getter function.

Specified by:
getActualType in interface PropertyMetaModel<T>
Returns:

getValueModel

public ClassMetaModel getValueModel()
Description copied from interface: PropertyMetaModel
If applicable, the value type's class model. Can be asked for explicitly to allow for non-class-based metamodels. It will return null for all primitive and basic types.

Specified by:
getValueModel in interface PropertyMetaModel<T>
Returns:

getGenericActualType

public java.lang.reflect.Type getGenericActualType()
Description copied from interface: PropertyMetaModel
The abomination that is Java Generics requires a separate dysfunctional type system to represent generic typing, at the few places it is available. This returns the generic type information that is present on whatever type is the return type. This CAN return NULL!!!

Specified by:
getGenericActualType in interface PropertyMetaModel<T>
Returns:

setValue

public void setValue(java.lang.Object target,
                     T value)
              throws java.lang.Exception
Specified by:
setValue in interface IValueAccessor<T>
Throws:
java.lang.Exception

getValue

public T getValue(java.lang.Object in)
           throws java.lang.Exception
Retrieve the value from this object. If the input object is null this throws IllegalStateException.

Specified by:
getValue in interface IValueTransformer<T>
Throws:
java.lang.Exception
See Also:
IValueTransformer.getValue(java.lang.Object)

getDefaultLabel

public java.lang.String getDefaultLabel()
Description copied from interface: PropertyMetaModel
Return any default label (the text to use before the control that inputs this property) for this property. The default label is obtained from the resource file with the same location and name as the class file containing the property after doing NLS language replacement; the label text is looked up in that file as 'propertyname.label='. The code uses the "current" locale as set in NlsContext to lookup the proper resource file.

Specified by:
getDefaultLabel in interface PropertyMetaModel<T>
Returns:
the label text, or null if unknown.

getDefaultHint

public java.lang.String getDefaultHint()
Description copied from interface: PropertyMetaModel
Returns the default hint text (which pops up when the mouse is held over the control that inputs this item). The hint text is a single, short, line of text. Like the default label this gets looked up in the resource file for the class this is a property of. The property that is looked up is 'propertyname.hint'.

Specified by:
getDefaultHint in interface PropertyMetaModel<T>
Returns:
The hint text, or null if not known.

getDomainValues

public java.lang.Object[] getDomainValues()
FIXME Needs to be filled in by some kind of factory, not in this thingy directly!! For enum and boolean property types this returns the possible values for the domain. Booleans always return Boolean.TRUE and Boolean.FALSE; enums return all enum values.

Specified by:
getDomainValues in interface PropertyMetaModel<T>
Returns:

getDomainValueLabel

public java.lang.String getDomainValueLabel(java.util.Locale loc,
                                            java.lang.Object val)
Get a property-related translation for a domain value for this property.

Specified by:
getDomainValueLabel in interface PropertyMetaModel<T>
Returns:
See Also:
PropertyMetaModel.getDomainValueLabel(java.util.Locale, java.lang.Object)

getLength

public int getLength()
Description copied from interface: PropertyMetaModel
Return the defined length for the item PROVIDED IT WAS SET - THIS SUFFERS FROM AN UTTER FUCKUP IN THE JPA "STANDARD". This is valid for string-type fields mostly, and should hold the size defined in the database. This field is usually set from the @Column annotation specified. But since that annotation was written by an idiot with a brain the size of a pea the "default" value for the length field in that annotation is set to 255. Since 255 is a valid length value this makes it impossible to determine if the actual length IS 255, or that the user did not provide a value and we need to calculate one ourselves.

Specified by:
getLength in interface PropertyMetaModel<T>
Returns:
The size in characters of this item, or -1 if unknown.

setLength

public void setLength(int length)

isPrimaryKey

public boolean isPrimaryKey()
Description copied from interface: PropertyMetaModel
Returns T if we know this property to be the PK.

Specified by:
isPrimaryKey in interface PropertyMetaModel<T>
Returns:

setPrimaryKey

public void setPrimaryKey(boolean primaryKey)

getComboDataSet

public java.lang.Class<? extends IComboDataSet<?>> getComboDataSet()
Description copied from interface: PropertyMetaModel
If this should be represented by a combo this can be set to represent the default combo dataset.

Specified by:
getComboDataSet in interface PropertyMetaModel<T>
Returns:

setComboDataSet

public void setComboDataSet(java.lang.Class<? extends IComboDataSet<?>> comboDataSet)

getComboLabelRenderer

public java.lang.Class<? extends ILabelStringRenderer<?>> getComboLabelRenderer()
Description copied from interface: PropertyMetaModel
When this relation-property is presented as a single field this can contain a class to render that field as a string.

Specified by:
getComboLabelRenderer in interface PropertyMetaModel<T>
Returns:

setComboLabelRenderer

public void setComboLabelRenderer(java.lang.Class<? extends ILabelStringRenderer<?>> comboLabelRenderer)

getComboDisplayProperties

public java.util.List<DisplayPropertyMetaModel> getComboDisplayProperties()
Description copied from interface: PropertyMetaModel
For a relation, this is the list of properties that should be shown. This is needed ONLY when the class metadata of the parent record does not specify a default display column or columnset.

Specified by:
getComboDisplayProperties in interface PropertyMetaModel<T>
Returns:

setComboDisplayProperties

public void setComboDisplayProperties(java.util.List<DisplayPropertyMetaModel> displayProperties)

getRelationType

public PropertyRelationType getRelationType()
Description copied from interface: PropertyMetaModel
Tells if this property represents some kind of database relation (a "parent" property referring to the master of this child record, or a property representing the list of children).

Specified by:
getRelationType in interface PropertyMetaModel<T>
Returns:

setRelationType

public void setRelationType(PropertyRelationType relationType)

getClassModel

public ClassMetaModel getClassModel()
Description copied from interface: PropertyMetaModel
The ClassModel that this property is a property of.

Specified by:
getClassModel in interface PropertyMetaModel<T>
Returns:

getComboNodeRenderer

public java.lang.Class<? extends INodeContentRenderer<?>> getComboNodeRenderer()
Description copied from interface: PropertyMetaModel
When set this renderer should be used to render the nodes in the combobox.

Specified by:
getComboNodeRenderer in interface PropertyMetaModel<T>
Returns:

setComboNodeRenderer

public void setComboNodeRenderer(java.lang.Class<? extends INodeContentRenderer<?>> comboNodeRenderer)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getLookupSelectedRenderer

public java.lang.Class<? extends INodeContentRenderer<?>> getLookupSelectedRenderer()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the renderer to use to display the currently selected record in the edit page. If empty this will use the lookupFieldDisplayProperties.

Specified by:
getLookupSelectedRenderer in interface PropertyMetaModel<T>
Returns:

setLookupSelectedRenderer

public void setLookupSelectedRenderer(java.lang.Class<? extends INodeContentRenderer<?>> lookupFieldRenderer)

getLookupSelectedProperties

public java.util.List<DisplayPropertyMetaModel> getLookupSelectedProperties()
When this class is to be selected as a parent in an UP relation using an InputLookup control this describes the properties to use to display the currently selected record in the edit page.

Specified by:
getLookupSelectedProperties in interface PropertyMetaModel<T>
Returns:

setLookupSelectedProperties

public void setLookupSelectedProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldDisplayProperties)

getLookupTableProperties

public java.util.List<DisplayPropertyMetaModel> getLookupTableProperties()
When used in a LookupInput field, this fields are used to show the result of a Search in the DataTable.

Specified by:
getLookupTableProperties in interface PropertyMetaModel<T>
Returns:

setLookupTableProperties

public void setLookupTableProperties(java.util.List<DisplayPropertyMetaModel> lookupFieldTableProperties)

getLookupFieldSearchProperties

public java.util.List<SearchPropertyMetaModel> getLookupFieldSearchProperties()
When used in a LookupInput field, this fields are used to create the search inputs.

Specified by:
getLookupFieldSearchProperties in interface PropertyMetaModel<T>
Returns:

setLookupFieldSearchProperties

public void setLookupFieldSearchProperties(java.util.List<SearchPropertyMetaModel> lookupFieldSearchProperties)

getLookupFieldKeySearchProperties

public java.util.List<SearchPropertyMetaModel> getLookupFieldKeySearchProperties()
When used in a LookupInput field, this fields are used to create the keyword search inputs.

Specified by:
getLookupFieldKeySearchProperties in interface PropertyMetaModel<T>
Returns:

setLookupFieldKeySearchProperties

public void setLookupFieldKeySearchProperties(java.util.List<SearchPropertyMetaModel> lookupFieldKeySearchProperties)

getComponentTypeHint

public java.lang.String getComponentTypeHint()
When present this gives a hint to the component factories to help with choosing a proper component to select a single record of the type specified by this property. This is only used when this property points to a parent in an UP relation, and the child needs to add a control to help it select one parent.

Specified by:
getComponentTypeHint in interface PropertyMetaModel<T>
Returns:

setComponentTypeHint

public void setComponentTypeHint(java.lang.String componentTypeHint)

getRenderHint

public java.lang.String getRenderHint()

setRenderHint

public void setRenderHint(java.lang.String renderHint)

getAnnotation

@Nullable
public <A> A getAnnotation(java.lang.Class<A> annclass)
This basic implementation returns annotations on the "getter" method of the property, if available.

Specified by:
getAnnotation in interface PropertyMetaModel<T>
Returns:
See Also:
PropertyMetaModel.getAnnotation(java.lang.Class)

getAnnotations

@Nonnull
public java.util.List<java.lang.Object> getAnnotations()
This basic implementation returns all annotations on the "getter" method of the property, if available. It returns the empty list if nothing is found.

Specified by:
getAnnotations in interface PropertyMetaModel<T>
Returns:
See Also:
PropertyMetaModel.getAnnotations()