Search in sources :

Example 1 with DateTimeFieldMetaData

use of org.jaffa.metadata.DateTimeFieldMetaData in project jaffa-framework by jaffa-projects.

the class EditBoxForm method getDataTypeDateTimeWM.

public WidgetModel getDataTypeDateTimeWM() {
    if (w_dataTypeDateTime == null) {
        w_dataTypeDateTime = new EditBoxModel(new DateTimeFieldMetaData());
        w_dataTypeDateTime.setValue(getDataTypeDateTime());
    }
    return w_dataTypeDateTime;
}
Also used : DateTimeFieldMetaData(org.jaffa.metadata.DateTimeFieldMetaData) EditBoxModel(org.jaffa.presentation.portlet.widgets.model.EditBoxModel)

Example 2 with DateTimeFieldMetaData

use of org.jaffa.metadata.DateTimeFieldMetaData in project jaffa-framework by jaffa-projects.

the class DateTimeFieldValidator method validate.

/**
 * The RulesEngine will invoke this method to perform the field validation.
 * @throws ValidationException if any validation rule fails.
 * @throws FrameworkException if any framework error occurs.
 */
public void validate() throws ValidationException, FrameworkException {
    Object value = getValue();
    if (value != null) {
        DateTimeFieldMetaData meta = new DateTimeFieldMetaData(null, getLabelToken(), null, getLayout(), getMinValue(), getMaxValue());
        if (value instanceof DateTime)
            FieldValidator.validate((DateTime) value, meta, false);
        else if (value instanceof Date)
            FieldValidator.validate(new DateTime((Date) value), meta, false);
        else
            FieldValidator.validateData(value.toString(), meta);
    }
}
Also used : DateTimeFieldMetaData(org.jaffa.metadata.DateTimeFieldMetaData) DateTime(org.jaffa.datatypes.DateTime) Date(java.util.Date)

Aggregations

DateTimeFieldMetaData (org.jaffa.metadata.DateTimeFieldMetaData)2 Date (java.util.Date)1 DateTime (org.jaffa.datatypes.DateTime)1 EditBoxModel (org.jaffa.presentation.portlet.widgets.model.EditBoxModel)1