Annotation: @Face - TheOpenCloudEngine/metaworks GitHub Wiki

@Face Annotation

Face annotation provides rendering hints such as EJS (Embedded Java Script) template or Face class.

Options

  • ejsPath is the relative url path for accessing EJS template (.ejs)

      @Face(
      		ejsPath="dwr/metaworks/org/uengine/codi/mw3/model/IWorkItem.ejs",
      		ejsPathForArray="dwr/metaworks/org/uengine/codi/mw3/model/IWorkItem_array.ejs",
      		ejsPathMappingByContext=
      	{
      		"{when: 'new', face: 'dwr/metaworks/org/uengine/codi/mw3/model/IWorkItem_edit.ejs'}",
      		"{when: 'edit', face: 'dwr/metaworks/org/uengine/codi/mw3/model/IWorkItem_edit.ejs'}",
      	}		
      
      )
    
  • faceClass is UI class for rendering this object. The prototype of face class is org.metaworks.Face interface:

      package org.metaworks;
    
      public interface Face<T> {
    
      	public void setValueToFace(T value);
    
      	public T createValueFromFace();
    
      }
    

Special EJS Paths and Face Classes

  • dwr/metaworks/genericfaces/CleanObjectFace will render the object fields without the labels and title.

  • Face.class will override the Face class options to empty.

  • AllChildFacesAreIgnored.class will ignore Face options for all the child elements from the specified point

      public class ObjectInstance implements Serializable, ContextAware, BeanPropertyResolver {
      
          ClassDefinition classDefinition;
          @Face(faceClass = AllChildFacesAreIgnored.class)     
              public ClassDefinition getClassDefinition() {
                  return classDefinition;
              }
              public void setClassDefinition(ClassDefinition classDefinition) {
                  this.classDefinition = classDefinition;
              }
      
      }