Buggy code:
public class DropPanelDropController extends FlowPanelDropController implements DropControllerExtended { private final Positioner positioner = new Positioner ( ) ; private final ResourceId resourceId ; private FormDesigner formDesigner ; private FlowPanel dropTarget ; private final Map < ResourceId , WidgetContainer > containerMap = Maps . newHashMap ( ) ; public DropPanelDropController ( ResourceId resourceId , FlowPanel dropTarget , FormDesigner formDesigner ) { } @ Override public void onPreviewDrop ( DragContext context ) throws VetoDragException { } private void previewDropNewWidget ( final DragContext context ) throws VetoDragException { final Template template = ( ( DnDLabel ) ( context . draggable ) ) . getTemplate ( ) ; if ( template instanceof FieldTemplate ) { final FormField formField = ( ( FieldTemplate ) ( template ) ) . create ( ) ; <START_BUG> FormClass formClass = ( ( FormClass ) ( formDesigner . getModel ( ) . getElementContainer ( resourceId ) ) ) ; <END_BUG> formDesigner . getFormFieldWidgetFactory ( ) . createWidget ( formClass , formField , INSTANCE ) . then ( new Function < FormFieldWidget , Void > ( ) { @ Nullable @ Override public Void apply ( @ Nullable FormFieldWidget formFieldWidget ) { final FieldWidgetContainer fieldWidgetContainer = new FieldWidgetContainer ( formDesigner , formFieldWidget , formField , resourceId ) ; containerMap . put ( formField . getId ( ) , fieldWidgetContainer ) ; drop ( fieldWidgetContainer , context , formField ) ; return null ; } } ) ; } else if ( template instanceof SectionTemplate ) { final FormSection formSection = ( ( SectionTemplate ) ( template ) ) . create ( ) ; if ( ( formDesigner . getModel ( ) . getElementContainer ( resourceId ) ) instanceof FormSection ) { throw new VetoDragException ( ) ; } FieldsHolderWidgetContainer widgetContainer = FieldsHolderWidgetContainer . section ( formDesigner , formSection , resourceId ) ; containerMap . put ( resourceId , widgetContainer ) ; drop ( widgetContainer , context , formSection ) ; } else if ( template instanceof SubformTemplate ) { final FormField formField = ( ( SubformTemplate ) ( template ) ) . create ( ) ; FormClass subForm = formDesigner . getModel ( ) . registerNewSubform ( formField . getId ( ) ) ; subForm . setLabel ( formField . getLabel ( ) ) ; SubFormType type = ( ( SubFormType ) ( formField . getType ( ) ) ) ; type . getClassReference ( ) . setRange ( subForm . getId ( ) ) ; final FieldsHolderWidgetContainer widgetContainer = FieldsHolderWidgetContainer . subform ( formDesigner , subForm , formField . getId ( ) ) ; containerMap . put ( formField . getId ( ) , widgetContainer ) ; drop ( widgetContainer . asWidget ( ) , context ) ; int widgetIndex = dropTarget . getWidgetIndex ( widgetContainer . asWidget ( ) ) ; formDesigner . getModel ( ) . getElementContainer ( resourceId ) . insertElement ( widgetIndex , formField ) ; formDesigner . getEventBus ( ) . fireEvent ( new org . activityinfo . ui . client . component . formdesigner . event . PanelUpdatedEvent ( widgetContainer , EventType . ADDED ) ) ; formDesigner . getDragController ( ) . makeDraggable ( widgetContainer . asWidget ( ) , widgetContainer . getDragHandle ( ) ) ; removePositioner ( ) ; } throw new VetoDragException ( ) ; } private void drop ( final Widget widget , DragContext context ) { } private void drop ( final WidgetContainer widgetContainer , DragContext context , final FormElement formElement ) { } @ Override protected Widget newPositioner ( DragContext context ) { } @ Override public void setPositionerToEnd ( ) { } private void removePositioner ( ) { } public Map < ResourceId , WidgetContainer > getContainerMap ( ) { } }

Fix:
FormClass formClass = formDesigner . getModel ( ) . getFormClassByElementId ( resourceId ) ;