Search in sources :

Example 11 with DateChooser

use of org.olat.core.gui.components.form.flexible.elements.DateChooser in project openolat by klemens.

the class DatePropertyHandler method isValid.

/**
 * @see org.olat.user.propertyhandlers.UserPropertyHandler#isValid(org.olat.core.gui.components.form.flexible.FormItem, java.util.Map)
 */
@Override
public boolean isValid(User user, FormItem formItem, Map<String, String> formContext) {
    DateChooser dateElem = (DateChooser) formItem;
    if (dateElem.isEmpty()) {
        return !dateElem.isMandatory() || !dateElem.isEmpty("new.form.mandatory");
    }
    List<ValidationStatus> validation = new ArrayList<ValidationStatus>();
    dateElem.validate(validation);
    if (validation.size() == 0) {
        return true;
    } else {
        // errorkey should be set by dateElem.validate formItem.setErrorKey(i18nFormElementLabelKey()+ ".error", null);
        return false;
    }
}
Also used : ValidationStatus(org.olat.core.util.ValidationStatus) ArrayList(java.util.ArrayList) DateChooser(org.olat.core.gui.components.form.flexible.elements.DateChooser)

Example 12 with DateChooser

use of org.olat.core.gui.components.form.flexible.elements.DateChooser in project openolat by klemens.

the class MetadatasStepController method forgeRow.

private DueDateWrapper forgeRow(int i, FormLayoutContainer tableCont) {
    String title = data.getNodePrefix() + " " + (i + 1);
    TextElement titleEl = uifactory.addTextElement("title_" + i, null, 32, title, tableCont);
    titleEl.setDisplaySize(21);
    DateChooser dueDateEl = uifactory.addDateChooser("duedate_" + i, "config.due.date", null, tableCont);
    dueDateEl.setDateChooserTimeEnabled(true);
    DueDateWrapper wrapper = new DueDateWrapper(titleEl, dueDateEl);
    return wrapper;
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) DateChooser(org.olat.core.gui.components.form.flexible.elements.DateChooser)

Aggregations

DateChooser (org.olat.core.gui.components.form.flexible.elements.DateChooser)12 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)6 ArrayList (java.util.ArrayList)4 Date (java.util.Date)4 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)4 SingleSelection (org.olat.core.gui.components.form.flexible.elements.SingleSelection)4 StaticTextElement (org.olat.core.gui.components.form.flexible.elements.StaticTextElement)4 FormLayoutContainer (org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)4 File (java.io.File)2 SimpleDateFormat (java.text.SimpleDateFormat)2 StringTokenizer (java.util.StringTokenizer)2 TimeZone (java.util.TimeZone)2 Invitation (org.olat.basesecurity.Invitation)2 RichTextElement (org.olat.core.gui.components.form.flexible.elements.RichTextElement)2 FormLinkImpl (org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl)2 Identity (org.olat.core.id.Identity)2 ValidationStatus (org.olat.core.util.ValidationStatus)2 CustomField (org.olat.course.nodes.projectbroker.datamodel.CustomField)2 Project (org.olat.course.nodes.projectbroker.datamodel.Project)2 ProjectEvent (org.olat.course.nodes.projectbroker.datamodel.ProjectEvent)2