Search in sources :

Example 1 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class FieldProcessorTest method testMakePropertyFieldDefinition.

public void testMakePropertyFieldDefinition() throws Exception {
    PropertyFieldProcessor processor = new PropertyFieldProcessor();
    processor.setNamespaceService(namespaceService);
    String name1 = PROP + ":" + PREFIX + ":" + NAME1;
    Field field = processor.generateField(name1, data);
    PropertyFieldDefinition propFieldDef = (PropertyFieldDefinition) field.getFieldDefinition();
    assertNotNull(propFieldDef);
    assertEquals("prop_" + PREFIX + "_" + NAME1, propFieldDef.getDataKeyName());
    assertEquals(PREFIX + ":" + NAME1, propFieldDef.getName());
    assertEquals(PREFIX + ":" + NAME1, propFieldDef.getLabel());
    assertEquals("Default1", propFieldDef.getDefaultValue());
    assertEquals(DESCRIPTION1, propFieldDef.getDescription());
    assertFalse(propFieldDef.isProtectedField());
    assertFalse(propFieldDef.isMandatory());
    // Maps to isMultiValued() on
    assertFalse(propFieldDef.isRepeating());
    // Repeat using different params to ensuere the fieldDefinition values
    // are dependant on the PropertyDefinition values.
    String name2 = PROP + ":" + PREFIX + ":" + NAME2;
    field = processor.generateField(name2, data);
    propFieldDef = (PropertyFieldDefinition) field.getFieldDefinition();
    assertEquals(TITLE, propFieldDef.getLabel());
    assertEquals(DESCRIPTION2, propFieldDef.getDescription());
    assertEquals("Default2", propFieldDef.getDefaultValue());
    assertTrue(propFieldDef.isProtectedField());
    assertTrue(propFieldDef.isMandatory());
    assertTrue(propFieldDef.isRepeating());
}
Also used : Field(org.alfresco.repo.forms.Field) PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 2 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class TransitionFieldProcessor method makeTransientFieldDefinition.

/* (non-Javadoc)
     * @see org.alfresco.repo.forms.processor.node.TransientFieldProcessor#makeTransientPropertyDefinition()
     */
@Override
protected FieldDefinition makeTransientFieldDefinition() {
    PropertyFieldDefinition fieldDef = new PropertyFieldDefinition(KEY, DATA_TYPE);
    fieldDef.setRepeating(false);
    fieldDef.setProtectedField(true);
    fieldDef.setLabel(I18NUtil.getMessage(MSG_LABEL));
    fieldDef.setDescription(I18NUtil.getMessage(MSG_DESCRIPTION));
    fieldDef.setDataKeyName(PROP_DATA_PREFIX + KEY);
    return fieldDef;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 3 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class TaskOwnerFieldProcessor method makeTransientFieldDefinition.

/* (non-Javadoc)
     * @see org.alfresco.repo.forms.processor.node.TransientFieldProcessor#makeTransientPropertyDefinition()
     */
@Override
protected FieldDefinition makeTransientFieldDefinition() {
    PropertyFieldDefinition fieldDef = new PropertyFieldDefinition(KEY, DATA_TYPE);
    fieldDef.setRepeating(false);
    fieldDef.setProtectedField(true);
    fieldDef.setLabel(I18NUtil.getMessage(MSG_LABEL));
    fieldDef.setDescription(I18NUtil.getMessage(MSG_DESCRIPTION));
    fieldDef.setDataKeyName(PROP_DATA_PREFIX + KEY);
    return fieldDef;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 4 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project records-management by Alfresco.

the class RecordsManagementNodeFormFilter method addTransientPropertyField.

/**
 * @param form
 * @param name
 * @param type
 * @param value
 */
protected void addTransientPropertyField(Form form, String name, QName type, Object value) {
    String dataKeyName = FormFieldConstants.PROP_DATA_PREFIX + name;
    PropertyFieldDefinition declaredField = new PropertyFieldDefinition(name, type.getLocalName());
    declaredField.setLabel(name);
    declaredField.setDescription(name);
    declaredField.setProtectedField(true);
    declaredField.setDataKeyName(dataKeyName);
    form.addFieldDefinition(declaredField);
    form.addData(dataKeyName, value);
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Example 5 with PropertyFieldDefinition

use of org.alfresco.repo.forms.PropertyFieldDefinition in project alfresco-repository by Alfresco.

the class MimetypeFieldProcessor method makeTransientFieldDefinition.

@Override
protected FieldDefinition makeTransientFieldDefinition() {
    String dataKeyName = PROP_DATA_PREFIX + KEY;
    PropertyFieldDefinition mimetypeField = new PropertyFieldDefinition(KEY, DataTypeDefinition.TEXT.getLocalName());
    mimetypeField.setLabel(I18NUtil.getMessage(MSG_MIMETYPE_LABEL));
    mimetypeField.setDescription(I18NUtil.getMessage(MSG_MIMETYPE_DESC));
    mimetypeField.setDataKeyName(dataKeyName);
    return mimetypeField;
}
Also used : PropertyFieldDefinition(org.alfresco.repo.forms.PropertyFieldDefinition)

Aggregations

PropertyFieldDefinition (org.alfresco.repo.forms.PropertyFieldDefinition)10 Field (org.alfresco.repo.forms.Field)1 FieldConstraint (org.alfresco.repo.forms.PropertyFieldDefinition.FieldConstraint)1 QName (org.alfresco.service.namespace.QName)1