|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.kuali.student.common.ui.client.configurable.mvc.FieldDescriptor
public class FieldDescriptor
This is a field descriptor that defines ui fields.
A field descriptor is defined by its fieldKey and its metadata, the field key is the key that is used
to identify it during validation and save processing and maps directly to a field which exists in the
model definition for the model it relates to. The fieldKey must match something within the model to
be a valid field.
The metadata is its piece of information in the model definition which is used to
generate the field's widget and determine what the validation on this field is (also if this field
is backed by a search it will use the lookup metadata defined in its metadata to generate the appropriate
search widget). It also determines if a requiredness indicator appears (constraint minOccurs > 1).
A field descriptor can be fully customized to any need, the widget can be chosen to be
defined directly instead of using one that is auto generated by the metadata - if this is done make sure
the data type it is using works with what is in the metadata and that it implements one of these standard
interfaces:
HasText
KSSelectItemWidgetAbstract
HasDataValue
HasValue
or, you MUST override the ModelWidgetBinding by calling setModelWidgetBinding
Setting the ModelWidgetBinding allows you to manipulate the widget's data and model data as you see fit
before a save when model data is loaded into the widget.
General layout of a field generated by FieldDescriptor, all elements are conditional based on the field's
configuration:
[label][requiredness indicator][help]
[input widget]
[constraint text]
The messageKeyInfo passed in is used to generate the messages needed for a field these include:
Field Label
Help text
Instructions
Constraint text
Watermark text - only if the widget one that accepts text input
These are generated by a single key, the additional text is determined by special suffixes on keys within
the messages data - example - you pass in "sampleField" for the message key - it is automatically determined
that if there is a message in the message data named "sampleField-instruct", instructions will be added to the field
in the appropriate location.
List of the appended keys for use in messages data:
"-help" for help text
"-instruct" for instructions
"-constraints" for constraint text
"-watermark" for watermark text
FieldElement
,
Section
,
BaseSection
,
Configurer
Field Summary | |
---|---|
private boolean |
dirty
|
private FieldElement |
fieldElement
|
protected String |
fieldKey
|
private boolean |
hasHadFocus
|
private MessageKeyInfo |
messageKey
|
protected Metadata |
metadata
|
private String |
modelId
|
private ModelWidgetBinding |
modelWidgetBinding
|
private boolean |
optional
|
private Callback<Boolean> |
validationRequestCallback
|
Constructor Summary | |
---|---|
FieldDescriptor(String fieldKey,
MessageKeyInfo messageKey,
Metadata metadata)
|
|
FieldDescriptor(String fieldKey,
MessageKeyInfo messageKey,
Metadata metadata,
com.google.gwt.user.client.ui.Widget fieldWidget)
|
Method Summary | |
---|---|
protected void |
addStyleToWidget(com.google.gwt.user.client.ui.Widget w)
|
protected com.google.gwt.user.client.ui.Widget |
createFieldWidget()
|
FieldElement |
getFieldElement()
|
String |
getFieldKey()
|
String |
getFieldLabel()
|
com.google.gwt.user.client.ui.Widget |
getFieldWidget()
|
MessageKeyInfo |
getMessageKey()
|
Metadata |
getMetadata()
|
String |
getModelId()
|
ModelWidgetBinding<?> |
getModelWidgetBinding()
|
Callback<Boolean> |
getValidationRequestCallback()
|
boolean |
hasHadFocus()
Return true if the field has been touched by the user in some fashion, this is set by the field's section |
void |
hideLabel()
|
boolean |
isDirty()
Returns true if this field is marked as dirty. |
boolean |
isLabelShown()
|
boolean |
isOptional()
Fields that are optional should not be displayed if there is no data in some cases, it is up to the section implementation whether or not to honor this flag |
boolean |
isVisible()
|
void |
setDirty(boolean dirty)
|
void |
setFieldKey(String fieldKey)
|
void |
setFieldWidget(com.google.gwt.user.client.ui.Widget fieldWidget)
|
void |
setHasHadFocus(boolean hasHadFocus)
|
void |
setMessageKey(MessageKeyInfo messageKey)
|
void |
setMetadata(Metadata metadata)
|
void |
setModelId(String modelId)
|
void |
setOptional(boolean optional)
Sets the optional flag Fields that are optional should not be displayed if there is no data in some cases, it is up to the section implementation whether or not to honor this flag |
protected void |
setupField()
|
void |
setValidationCallBack(Callback<Boolean> callback)
Allows additional processing to happen when a validation check is being processed when the input widget loses focus defined in the callback |
void |
setWidgetBinding(ModelWidgetBinding widgetBinding)
Sets the ModelWidgetBinding for this field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected String fieldKey
protected Metadata metadata
private ModelWidgetBinding modelWidgetBinding
private Callback<Boolean> validationRequestCallback
private boolean dirty
private boolean hasHadFocus
private final FieldElement fieldElement
private String modelId
private MessageKeyInfo messageKey
private boolean optional
Constructor Detail |
---|
public FieldDescriptor(String fieldKey, MessageKeyInfo messageKey, Metadata metadata)
fieldKey
- - key for this field which matches a field in the overall model definition that this
field will be used formessageKey
- - key object used for determing field labelsmetadata
- - metadata used to determine requiredness, validation, and autogenerated widgetpublic FieldDescriptor(String fieldKey, MessageKeyInfo messageKey, Metadata metadata, com.google.gwt.user.client.ui.Widget fieldWidget)
fieldKey
- - key for this field which matches a field in the overall model definition that this
field will be used formessageKey
- - key object used for determing field labelsmetadata
- - metadata used to determine requiredness and validationfieldWidget
- - widget to use instead of an automatically determined oneMethod Detail |
---|
protected void addStyleToWidget(com.google.gwt.user.client.ui.Widget w)
protected void setupField()
public void hideLabel()
FieldElement.hideLabel()
public boolean isLabelShown()
public FieldElement getFieldElement()
public String getFieldKey()
public void setFieldKey(String fieldKey)
public String getFieldLabel()
public com.google.gwt.user.client.ui.Widget getFieldWidget()
protected com.google.gwt.user.client.ui.Widget createFieldWidget()
public ModelWidgetBinding<?> getModelWidgetBinding()
public void setValidationCallBack(Callback<Boolean> callback)
callback
- public Callback<Boolean> getValidationRequestCallback()
public boolean isDirty()
public void setDirty(boolean dirty)
public boolean hasHadFocus()
public void setHasHadFocus(boolean hasHadFocus)
public Metadata getMetadata()
public void setMetadata(Metadata metadata)
public void setFieldWidget(com.google.gwt.user.client.ui.Widget fieldWidget)
public String getModelId()
public void setModelId(String modelId)
public void setWidgetBinding(ModelWidgetBinding widgetBinding)
widgetBinding
- public MessageKeyInfo getMessageKey()
public void setMessageKey(MessageKeyInfo messageKey)
public void setOptional(boolean optional)
optional
- public boolean isOptional()
public boolean isVisible()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |