public ElementBase createElement ( ElementBase parent , IPropertyProvider propertyProvider , boolean deserializing ) { try { ElementBase element = null ; if ( isForbidden ( ) ) { log . info ( "Access to plugin " + getName ( ) + " is restricted." ) ; } else if ( isDisabled ( ) ) { log . info ( "Plugin " + getName ( ) + " has been disabled." ) ; } else { Class < ? extends ElementBase > clazz = getClazz ( ) ; if ( isInternal ( ) ) { element = parent . getChild ( clazz , null ) ; } else { element = clazz . newInstance ( ) ; } if ( element == null ) { CWFException . raise ( "Failed to create UI element " + id + "." ) ; } element . setDefinition ( this ) ; element . beforeInitialize ( deserializing ) ; initElement ( element , propertyProvider ) ; if ( parent != null ) { element . setParent ( parent ) ; } element . afterInitialize ( deserializing ) ; } return element ; } catch ( Exception e ) { throw MiscUtil . toUnchecked ( e ) ; } }
Creates an instance of the element based on its definition . If a property source is specified the source is used to initialize properties on the newly created element .