最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Vaadin DropTarget is not working in Production Mode anymore after updating from 24.1. to 24.6 - Stack Overflow

programmeradmin1浏览0评论

Drag and Drop works fine when using a Wildfly in Eclipse during development, however after building the .war in production mode and deploying on Wildfly the drop target is not recognized as one (see gif at the bottom):

Expected Behaviour:

Before the update to Vaadin 24.6. everything worked fine, too.

Example to reproduce is similiar to Documentation here

    public TestDropComponent() {

    VerticalLayout dropLayout= new VerticalLayout();
    DropTarget<VerticalLayout> dropTarget = DropTarget.create(dropLayout);
    
    dropTarget.setDropEffect(DropEffect.MOVE);
    dropTarget.addDropListener(e -> System.out.println("Element dropped"));
    dropTarget.setActive(true);

    this.add(dropLayout);
    
    
    Div box1 = new Div();
    DragSource<Div> box1DragSource = DragSource.create(box1);
    add(box1);
}

Browser Console may be usefull:

VM1176:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDragSource')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
VM1199:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDropTarget')
    at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
    at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
    at EE (FlowClient-CjLkgOY_.js:3:44163)
    at Zg (FlowClient-CjLkgOY_.js:3:23009)
    at u0 (FlowClient-CjLkgOY_.js:1:24807)
    at em (FlowClient-CjLkgOY_.js:1:17085)
    at z.fb (FlowClient-CjLkgOY_.js:3:72829)
    at ro (FlowClient-CjLkgOY_.js:3:15668)
    at TE (FlowClient-CjLkgOY_.js:3:46524)
    at z.D (FlowClient-CjLkgOY_.js:3:72615)
    at Yr (FlowClient-CjLkgOY_.js:1:41683)
    at z.eb (FlowClient-CjLkgOY_.js:3:61800)
    at z.J (FlowClient-CjLkgOY_.js:3:66191)
    at FlowClient-CjLkgOY_.js:3:12557

Any guidance what causes this behaviour would be greatly appreciated.

EDIT: I compared the html of the working and not-working version, the difference in the working version is marked:

align-items: center; min-width: 50%;"><vaadin-horizontal-layout id="Target Id: 0/1" class="" style="width: 100%; border-color: rgb(16, 110, 190); border-width: 1px; margin-bottom: 10px; border-style: dashed; height: 100%;"><vaadin-horizontal-layout id="source" draggable="true" style="width: 100%; height: 100%;"><

Drag and Drop works fine when using a Wildfly in Eclipse during development, however after building the .war in production mode and deploying on Wildfly the drop target is not recognized as one (see gif at the bottom):

Expected Behaviour:

Before the update to Vaadin 24.6. everything worked fine, too.

Example to reproduce is similiar to Documentation here

    public TestDropComponent() {

    VerticalLayout dropLayout= new VerticalLayout();
    DropTarget<VerticalLayout> dropTarget = DropTarget.create(dropLayout);
    
    dropTarget.setDropEffect(DropEffect.MOVE);
    dropTarget.addDropListener(e -> System.out.println("Element dropped"));
    dropTarget.setActive(true);

    this.add(dropLayout);
    
    
    Div box1 = new Div();
    DragSource<Div> box1DragSource = DragSource.create(box1);
    add(box1);
}

Browser Console may be usefull:

VM1176:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDragSource')
at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
at EE (FlowClient-CjLkgOY_.js:3:44163)
at Zg (FlowClient-CjLkgOY_.js:3:23009)
at u0 (FlowClient-CjLkgOY_.js:1:24807)
at em (FlowClient-CjLkgOY_.js:1:17085)
at z.fb (FlowClient-CjLkgOY_.js:3:72829)
at ro (FlowClient-CjLkgOY_.js:3:15668)
at TE (FlowClient-CjLkgOY_.js:3:46524)
at z.D (FlowClient-CjLkgOY_.js:3:72615)
at Yr (FlowClient-CjLkgOY_.js:1:41683)
at z.eb (FlowClient-CjLkgOY_.js:3:61800)
at z.J (FlowClient-CjLkgOY_.js:3:66191)
at FlowClient-CjLkgOY_.js:3:12557
VM1199:3 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'updateDropTarget')
    at HorizontalLayout.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:60)
    at Object.eval (eval at EE (FlowClient-CjLkgOY_.js:3:44102), <anonymous>:3:83)
    at EE (FlowClient-CjLkgOY_.js:3:44163)
    at Zg (FlowClient-CjLkgOY_.js:3:23009)
    at u0 (FlowClient-CjLkgOY_.js:1:24807)
    at em (FlowClient-CjLkgOY_.js:1:17085)
    at z.fb (FlowClient-CjLkgOY_.js:3:72829)
    at ro (FlowClient-CjLkgOY_.js:3:15668)
    at TE (FlowClient-CjLkgOY_.js:3:46524)
    at z.D (FlowClient-CjLkgOY_.js:3:72615)
    at Yr (FlowClient-CjLkgOY_.js:1:41683)
    at z.eb (FlowClient-CjLkgOY_.js:3:61800)
    at z.J (FlowClient-CjLkgOY_.js:3:66191)
    at FlowClient-CjLkgOY_.js:3:12557

Any guidance what causes this behaviour would be greatly appreciated.

EDIT: I compared the html of the working and not-working version, the difference in the working version is marked:

align-items: center; min-width: 50%;"><vaadin-horizontal-layout id="Target Id: 0/1" class="" style="width: 100%; border-color: rgb(16, 110, 190); border-width: 1px; margin-bottom: 10px; border-style: dashed; height: 100%;"><vaadin-horizontal-layout id="source" draggable="true" style="width: 100%; height: 100%;"><

Share Improve this question edited Jan 29 at 14:02 Toden asked Jan 29 at 13:32 TodenToden 334 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 0

I can spot one difference to my code where I am using the feature with success, I am setting the effect also in the source.

dragSource.setEffectAllowed(EffectAllowed.MOVE);

The dndConnector.js is not loaded and that's why the JS console is showing the errors. This can happen if the Production build of the Vaadin application did not include that JS resource as part of the packaging. Vaadin adds such resources if your Route annotated classes use those resources. However, it can not determine the required resources if something is constructed indirectly (for example, via Java reflection). In such cases, there are other means of informing Vaadin about it using @Use and @JsModule annotations.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论